diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index aa56a7b..f65da55 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -11,11 +11,11 @@ env: jobs: check: - uses: ShuttlePub/workflows/.github/workflows/check.yml@a95cf7631a550a66628dd4a2a8d6ef4d253edab4 + uses: ShuttlePub/workflows/.github/workflows/check.yml@5be8e4cbb4f1f1616dc88316d469f3b13b059445 with: workspace: '[ "kernel", "application", "server" ]' check-driver: - uses: ShuttlePub/workflows/.github/workflows/test-psql.yml@454354614b775cd3b470c991b532e8db1c1ed89f + uses: ShuttlePub/workflows/.github/workflows/test-psql.yml@5be8e4cbb4f1f1616dc88316d469f3b13b059445 with: workspace: driver openapi-check: @@ -30,5 +30,5 @@ jobs: - name: Check for uncommitted diff run: git diff --exit-code openapi.json coverage: - uses: ShuttlePub/workflows/.github/workflows/coverage.yml@d4c43ec23ffeaf5538fc32bdf63aa5e042ccee61 + uses: ShuttlePub/workflows/.github/workflows/coverage.yml@5be8e4cbb4f1f1616dc88316d469f3b13b059445 secrets: inherit diff --git a/application/src/service/organization/tests.rs b/application/src/service/organization/tests.rs index c8e14d4..7e2c709 100644 --- a/application/src/service/organization/tests.rs +++ b/application/src/service/organization/tests.rs @@ -827,18 +827,20 @@ async fn owner_changes_active_member_role_to_admin() { #[tokio::test] async fn owner_removes_active_member() { let f = fixture(1); - let accounts = f.module.accounts.values.lock().unwrap(); - let org = accounts - .iter() - .find(|account| account.nanoid().as_ref() == "org") - .unwrap() - .clone(); - let owner = accounts - .iter() - .find(|account| account.nanoid().as_ref() == "owner") - .unwrap() - .clone(); - drop(accounts); + let (org, owner) = { + let accounts = f.module.accounts.values.lock().unwrap(); + let org = accounts + .iter() + .find(|account| account.nanoid().as_ref() == "org") + .unwrap() + .clone(); + let owner = accounts + .iter() + .find(|account| account.nanoid().as_ref() == "owner") + .unwrap() + .clone(); + (org, owner) + }; f.module .memberships .0 diff --git a/application/src/service/profile_transfer/cancel/tests.rs b/application/src/service/profile_transfer/cancel/tests.rs index 9305003..7934a45 100644 --- a/application/src/service/profile_transfer/cancel/tests.rs +++ b/application/src/service/profile_transfer/cancel/tests.rs @@ -1,5 +1,5 @@ use super::*; -use crate::service::profile_transfer::test_support::{fixture, Fixture}; +use crate::service::profile_transfer::test_support::fixture; use kernel::prelude::entity::{ AccountId, AccountKind, EventVersion, Nanoid, ProfileTransferRequest, ProfileTransferStatus, }; @@ -8,7 +8,7 @@ use kernel::KernelError; #[tokio::test] async fn cancel_succeeds_when_actor_owns_from_account() { - let mut f = fixture(); + let f = fixture(); f.module .cancel_profile_transfer_request(&f.auth, f.request_nanoid.clone()) .await @@ -89,7 +89,7 @@ async fn cancel_returns_not_found_for_unknown_request() { #[tokio::test] async fn cancel_updates_read_model() { - let mut f = fixture(); + let f = fixture(); f.module .cancel_profile_transfer_request(&f.auth, f.request_nanoid.clone()) .await diff --git a/application/src/service/profile_transfer/request/tests.rs b/application/src/service/profile_transfer/request/tests.rs index 3d23b09..a260142 100644 --- a/application/src/service/profile_transfer/request/tests.rs +++ b/application/src/service/profile_transfer/request/tests.rs @@ -127,7 +127,7 @@ async fn request_returns_permission_denied_when_actor_does_not_own_profile() { #[tokio::test] async fn request_returns_permission_denied_when_owner_not_active_member() { - let mut f = fixture(); + let f = fixture(); f.module.memberships.lock().unwrap().clear(); let err = f .module diff --git a/application/src/service/profile_transfer/test_support/mod.rs b/application/src/service/profile_transfer/test_support/mod.rs index 4f4f272..1674a6c 100644 --- a/application/src/service/profile_transfer/test_support/mod.rs +++ b/application/src/service/profile_transfer/test_support/mod.rs @@ -4,11 +4,6 @@ mod module; mod profile; mod request; -pub(super) use account::MockAccountQuery; -pub(super) use database::{MockConnection, MockDatabaseConnection}; pub(super) use module::{fixture, Fixture}; -pub(super) use profile::{profile_with_media, MockProfileReadModel, MockProfileRepository}; -pub(super) use request::{ - active_membership, MockProfileMediaCopyGateway, MockProfileTransferRequestReadModel, - MockProfileTransferRequestRepository, -}; +pub(super) use profile::profile_with_media; +pub(super) use request::active_membership; diff --git a/driver/src/database/postgres/profile_transfer_request.rs b/driver/src/database/postgres/profile_transfer_request.rs index d2a617f..16d6bf5 100644 --- a/driver/src/database/postgres/profile_transfer_request.rs +++ b/driver/src/database/postgres/profile_transfer_request.rs @@ -194,7 +194,7 @@ mod test { ProfileTransferRequestReadModel, }; use kernel::prelude::entity::{ - AccountId, AccountKind, EventVersion, Nanoid, ProfileId, ProfileTransferRequest, + AccountKind, EventVersion, Nanoid, ProfileId, ProfileTransferRequest, ProfileTransferRequestId, }; use kernel::test_utils::{AccountBuilder, ProfileBuilder}; diff --git a/kernel/src/entity/profile_transfer_request.rs b/kernel/src/entity/profile_transfer_request.rs index ec657f3..15977e7 100644 --- a/kernel/src/entity/profile_transfer_request.rs +++ b/kernel/src/entity/profile_transfer_request.rs @@ -195,6 +195,15 @@ impl EventApplier for ProfileTransferRequest { } } +fn status_name(status: &ProfileTransferStatus) -> &'static str { + match status { + ProfileTransferStatus::Pending => "pending", + ProfileTransferStatus::Accepted => "accepted", + ProfileTransferStatus::Rejected => "rejected", + ProfileTransferStatus::Cancelled => "cancelled", + } +} + #[cfg(test)] mod tests { use super::*; @@ -349,12 +358,3 @@ mod tests { assert_eq!(err.current_context(), &KernelError::Internal); } } - -fn status_name(status: &ProfileTransferStatus) -> &'static str { - match status { - ProfileTransferStatus::Pending => "pending", - ProfileTransferStatus::Accepted => "accepted", - ProfileTransferStatus::Rejected => "rejected", - ProfileTransferStatus::Cancelled => "cancelled", - } -} diff --git a/server/src/route/report/test_support.rs b/server/src/route/report/test_support.rs index 93610d4..6e5920c 100644 --- a/server/src/route/report/test_support.rs +++ b/server/src/route/report/test_support.rs @@ -96,7 +96,7 @@ impl ReportTestApp { let target_event = AccountEvent::Created { name: target.name().clone(), is_bot: target.is_bot().clone(), - kind: target.kind().clone(), + kind: *target.kind(), nanoid: target.nanoid().clone(), auth_account_id: auth_account_id.clone(), };