lock the service forge accounts out of creating organizations
This commit is contained in:
parent
07028557d1
commit
87dc4c5533
4 changed files with 55 additions and 12 deletions
|
|
@ -288,4 +288,25 @@ mod tests {
|
|||
assert!(format!("{err:#}").contains("not the swarm builder's"));
|
||||
assert!(lockdown_patch(&seen, LOGIN).is_none());
|
||||
}
|
||||
|
||||
/// An existing account is locked out of repo creation and of
|
||||
/// organizations on every pass.
|
||||
#[tokio::test]
|
||||
async fn the_job_locks_the_builder_out_of_repos_and_organizations() {
|
||||
use super::super::tests::{lockdown_patch, stub_forge};
|
||||
|
||||
let (client, seen) = stub_forge(
|
||||
(409, r#"{"message":"user already exists"}"#),
|
||||
(200, r#"{"email":"builder@services.hyperhive.local"}"#),
|
||||
(200, "{}"),
|
||||
)
|
||||
.await;
|
||||
client
|
||||
.ensure_builder_user()
|
||||
.await
|
||||
.expect("the builder's own account");
|
||||
let body = lockdown_patch(&seen, LOGIN).expect("no lockdown PATCH sent");
|
||||
assert_eq!(body["max_repo_creation"], 0);
|
||||
assert_eq!(body["allow_create_organization"], false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -473,4 +473,25 @@ mod tests {
|
|||
assert!(format!("{err:#}").contains("not the CI metrics poller's"));
|
||||
assert!(lockdown_patch(&seen, LOGIN).is_none());
|
||||
}
|
||||
|
||||
/// An existing account is locked out of repo creation and of
|
||||
/// organizations on every pass.
|
||||
#[tokio::test]
|
||||
async fn the_job_locks_the_poller_out_of_repos_and_organizations() {
|
||||
use super::super::tests::{lockdown_patch, stub_forge};
|
||||
|
||||
let (client, seen) = stub_forge(
|
||||
(409, r#"{"message":"user already exists"}"#),
|
||||
(200, r#"{"email":"ci-metrics@services.hyperhive.local"}"#),
|
||||
(200, "{}"),
|
||||
)
|
||||
.await;
|
||||
client
|
||||
.ensure_ci_metrics_user()
|
||||
.await
|
||||
.expect("the poller's own account");
|
||||
let body = lockdown_patch(&seen, LOGIN).expect("no lockdown PATCH sent");
|
||||
assert_eq!(body["max_repo_creation"], 0);
|
||||
assert_eq!(body["allow_create_organization"], false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -582,5 +582,6 @@ mod tests {
|
|||
.expect("the classifier's own account");
|
||||
let body = lockdown_patch(&seen, LOGIN).expect("no lockdown PATCH sent");
|
||||
assert_eq!(body["max_repo_creation"], 0);
|
||||
assert_eq!(body["allow_create_organization"], false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -660,6 +660,7 @@ mod tests {
|
|||
.expect("the hive's own account");
|
||||
let body = lockdown_patch(&seen, "hive-alpha").expect("no lockdown PATCH sent");
|
||||
assert_eq!(body["max_repo_creation"], 0);
|
||||
assert_eq!(body["allow_create_organization"], false);
|
||||
}
|
||||
|
||||
fn team(permission: TeamPermission, units: &[&str]) -> Team {
|
||||
|
|
|
|||
Loading…
Reference in a new issue