mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(organizations): add management account email configuration and tests (#2749)
Signed-off-by: Matheus André <matheusandr2@gmail.com>
This commit is contained in:
1 parent
c18af5b68a
commit
89fd37a5c4
4 files changed
+90
-3
No files matched your search
+42
@@ -352,4 +352,46 @@ class OrganizationsServiceTest {
|
||||
.getAccountId();
|
||||
assertNull(disabled.effectiveScpLevels(member));
|
||||
}
|
||||
|
||||
@Test
|
||||
void managementAccountEmailDefaultsToSynthesizedAddress() {
|
||||
Organization organization = service.createOrganization(MANAGEMENT_ACCOUNT, "ALL");
|
||||
|
||||
assertEquals("master@" + MANAGEMENT_ACCOUNT + ".example.com", organization.getMasterAccountEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
void managementAccountEmailOverrideIsUsedForOrganizationAndAccount() {
|
||||
OrganizationsService configured = new OrganizationsService(
|
||||
new ObjectMapper(),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
true,
|
||||
"root@corp.example");
|
||||
Organization organization = configured.createOrganization(MANAGEMENT_ACCOUNT, "ALL");
|
||||
|
||||
assertEquals("root@corp.example", organization.getMasterAccountEmail());
|
||||
assertEquals("root@corp.example",
|
||||
configured.describeAccount(MANAGEMENT_ACCOUNT, MANAGEMENT_ACCOUNT).getEmail());
|
||||
assertEquals("root@corp.example",
|
||||
configured.describeOrganization(MANAGEMENT_ACCOUNT).getMasterAccountEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
void malformedManagementAccountEmailOverrideIsRejected() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new OrganizationsService(
|
||||
new ObjectMapper(),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT),
|
||||
true,
|
||||
"not-an-email"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user