This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
generated from JupiterOne-Archives/integration-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from JupiterOne/INT-7619-fix-duplicated-key
INT-7619: fix duplicated Audit Config IAM Policy relationship key
- Loading branch information
Showing
2 changed files
with
108 additions
and
26 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { | |
buildOrgFolderProjectMappedRelationships, | ||
fetchIamPolicyAuditConfig, | ||
AUDIT_CONFIG_ENTITY_TYPE, | ||
flattenAuditLogConfigs, | ||
} from '.'; | ||
import { integrationConfig } from '../../../test/config'; | ||
import { | ||
|
@@ -31,6 +32,48 @@ import { fetchApiServices } from '../service-usage'; | |
import { fetchIamManagedRoles, fetchIamServiceAccounts } from '../iam'; | ||
import { separateDirectMappedRelationships } from '../../../test/helpers/separateDirectMappedRelationships'; | ||
|
||
describe('flattenAuditLogConfigs', () => { | ||
test('should flatten multiple log types onto the same exempted member', () => { | ||
expect( | ||
flattenAuditLogConfigs([ | ||
{ exemptedMembers: ['[email protected]', '[email protected]'], logType: 'type1' }, | ||
{ exemptedMembers: ['[email protected]', '[email protected]'], logType: 'type2' }, | ||
]), | ||
).toEqual([ | ||
{ exemptedMember: '[email protected]', logTypes: ['type1', 'type2'] }, | ||
{ exemptedMember: '[email protected]', logTypes: ['type1', 'type2'] }, | ||
]); | ||
}); | ||
|
||
test('should return empty array for `null` logType', () => { | ||
expect( | ||
flattenAuditLogConfigs([ | ||
{ exemptedMembers: ['[email protected]'], logType: null }, | ||
]), | ||
).toEqual([{ exemptedMember: '[email protected]', logTypes: [] }]); | ||
}); | ||
|
||
test('should return empty array for `undefined` logType', () => { | ||
expect( | ||
flattenAuditLogConfigs([ | ||
{ exemptedMembers: ['[email protected]'], logType: undefined }, | ||
]), | ||
).toEqual([{ exemptedMember: '[email protected]', logTypes: [] }]); | ||
}); | ||
|
||
test('should skip `null` exemptedMembers', () => { | ||
expect( | ||
flattenAuditLogConfigs([{ exemptedMembers: null, logType: 'type1' }]), | ||
).toEqual([]); | ||
}); | ||
|
||
test('should skip `undefined` exemptedMembers', () => { | ||
expect( | ||
flattenAuditLogConfigs([{ exemptedMembers: null, logType: 'type1' }]), | ||
).toEqual([]); | ||
}); | ||
}); | ||
|
||
describe('#fetchIamPolicyAuditConfig', () => { | ||
let recording: Recording; | ||
|
||
|
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