-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SW-4243 Support deletion of Terraformation Contact when deleting an o…
…rganization (#1376) - BE will handle deletion of last owner and Terraformation Contact when deleting an organization - This allows the FE client to delete an org which has a Terraformation Contact membership (which cannot be deleted by the organization owner)
- Loading branch information
1 parent
e243817
commit 75ff547
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,22 @@ internal class OrganizationServiceTest : DatabaseTest(), RunsAsUser { | |
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun `deleteOrganization removes Terraformation Contact user from organization`() { | ||
val tfContactUserId = UserId(5) | ||
insertUser() | ||
insertUser(userId = tfContactUserId, email = "[email protected]") | ||
insertOrganization() | ||
insertOrganizationUser(role = Role.Owner) | ||
insertOrganizationUser(userId = tfContactUserId, role = Role.TerraformationContact) | ||
|
||
service.deleteOrganization(organizationId) | ||
|
||
val expected = emptyList<OrganizationUsersRecord>() | ||
val actual = dslContext.selectFrom(ORGANIZATION_USERS).fetch() | ||
assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun `deleteOrganization publishes event on success`() { | ||
insertUser() | ||
|