From bd6d92f6b6b00d4e570e89098fe4d22b5e59d439 Mon Sep 17 00:00:00 2001 From: Cyborus Date: Tue, 12 Dec 2023 13:08:32 -0500 Subject: format --- tests/ci_test.rs | 76 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 16 deletions(-) (limited to 'tests/ci_test.rs') diff --git a/tests/ci_test.rs b/tests/ci_test.rs index 91b42eb..e059799 100644 --- a/tests/ci_test.rs +++ b/tests/ci_test.rs @@ -249,12 +249,30 @@ async fn admin(api: &forgejo_api::Forgejo) -> eyre::Result<()> { username: "Pipis".into(), visibility: "public".into(), }; - let _ = api.admin_create_user(user_opt).await.wrap_err("failed to create user")?; + let _ = api + .admin_create_user(user_opt) + .await + .wrap_err("failed to create user")?; - let users = api.admin_users(forgejo_api::AdminUserQuery::default()).await.wrap_err("failed to search users")?; - ensure!(users.iter().find(|u| u.login == "Pipis").is_some(), "could not find new user"); - let users = api.admin_get_emails(forgejo_api::EmailListQuery::default()).await.wrap_err("failed to search emails")?; - ensure!(users.iter().find(|u| u.email == "user@noreply.example.org").is_some(), "could not find new user"); + let users = api + .admin_users(forgejo_api::AdminUserQuery::default()) + .await + .wrap_err("failed to search users")?; + ensure!( + users.iter().find(|u| u.login == "Pipis").is_some(), + "could not find new user" + ); + let users = api + .admin_get_emails(forgejo_api::EmailListQuery::default()) + .await + .wrap_err("failed to search emails")?; + ensure!( + users + .iter() + .find(|u| u.email == "user@noreply.example.org") + .is_some(), + "could not find new user" + ); let org_opt = forgejo_api::CreateOrgOption { description: None, @@ -265,8 +283,16 @@ async fn admin(api: &forgejo_api::Forgejo) -> eyre::Result<()> { visibility: forgejo_api::OrgVisibility::Public, website: None, }; - let _ = api.admin_create_org("Pipis", org_opt).await.wrap_err("failed to create org")?; - ensure!(!api.admin_get_orgs(forgejo_api::AdminOrganizationQuery::default()).await?.is_empty(), "org list empty"); + let _ = api + .admin_create_org("Pipis", org_opt) + .await + .wrap_err("failed to create org")?; + ensure!( + !api.admin_get_orgs(forgejo_api::AdminOrganizationQuery::default()) + .await? + .is_empty(), + "org list empty" + ); let key_opt = forgejo_api::CreateKeyOption { key: "ssh-ed25519 00000000000000000000000000000000000000000000000000000000000000000000 user@noreply.example.org".into(), @@ -279,12 +305,24 @@ async fn admin(api: &forgejo_api::Forgejo) -> eyre::Result<()> { let rename_opt = forgejo_api::RenameUserOption { new_username: "Bepis".into(), }; - api.admin_rename_user("Pipis", rename_opt).await.wrap_err("failed to rename user")?; - api.admin_delete_user("Bepis", true).await.wrap_err("failed to delete user")?; - ensure!(api.admin_delete_user("Ghost", true).await.is_err(), "deleting fake user should fail"); + api.admin_rename_user("Pipis", rename_opt) + .await + .wrap_err("failed to rename user")?; + api.admin_delete_user("Bepis", true) + .await + .wrap_err("failed to delete user")?; + ensure!( + api.admin_delete_user("Ghost", true).await.is_err(), + "deleting fake user should fail" + ); - let crons = api.admin_get_crons(forgejo_api::CronQuery::default()).await.wrap_err("failed to get crons list")?; - api.admin_run_cron(&crons.get(0).ok_or_else(|| eyre!("no crons"))?.name).await.wrap_err("failed to run cron")?; + let crons = api + .admin_get_crons(forgejo_api::CronQuery::default()) + .await + .wrap_err("failed to get crons list")?; + api.admin_run_cron(&crons.get(0).ok_or_else(|| eyre!("no crons"))?.name) + .await + .wrap_err("failed to run cron")?; let hook_opt = forgejo_api::CreateHookOption { active: None, @@ -299,14 +337,20 @@ async fn admin(api: &forgejo_api::Forgejo) -> eyre::Result<()> { _type: forgejo_api::HookType::Forgejo, }; // yarr har har me matey this is me hook - let hook = api.admin_create_hook(hook_opt).await.wrap_err("failed to create hook")?; + let hook = api + .admin_create_hook(hook_opt) + .await + .wrap_err("failed to create hook")?; let edit_hook = forgejo_api::EditHookOption { active: Some(true), ..Default::default() }; - api.admin_edit_hook(hook.id, edit_hook).await.wrap_err("failed to edit hook")?; - api.admin_delete_hook(hook.id).await.wrap_err("failed to delete hook")?; + api.admin_edit_hook(hook.id, edit_hook) + .await + .wrap_err("failed to edit hook")?; + api.admin_delete_hook(hook.id) + .await + .wrap_err("failed to delete hook")?; Ok(()) } - -- cgit v1.2.3