generated from cds-snc/project-template
-
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.
* chore: fix docstrings * feat: simplify compare list function * fix: include unit test handles user creation failed * fix: conftest fixture for the aws groups with memberships
- Loading branch information
Showing
6 changed files
with
37 additions
and
71 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
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
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 |
---|---|---|
|
@@ -82,6 +82,33 @@ def test_create_user(mock_resolve_identity_store_id, mock_execute_aws_api_call): | |
assert result == "test_user_id" | ||
|
||
|
||
@patch("integrations.aws.identity_store.execute_aws_api_call") | ||
@patch("integrations.aws.identity_store.resolve_identity_store_id") | ||
def test_create_user_failed(mock_resolve_identity_store_id, mock_execute_aws_api_call): | ||
mock_resolve_identity_store_id.return_value = { | ||
"IdentityStoreId": "test_instance_id" | ||
} | ||
mock_execute_aws_api_call.return_value = False | ||
email = "[email protected]" | ||
first_name = "Test" | ||
family_name = "User" | ||
|
||
# Act | ||
result = identity_store.create_user(email, first_name, family_name) | ||
|
||
# Assert | ||
mock_execute_aws_api_call.assert_called_once_with( | ||
"identitystore", | ||
"create_user", | ||
IdentityStoreId="test_instance_id", | ||
UserName=email, | ||
Emails=[{"Value": email, "Type": "WORK", "Primary": True}], | ||
Name={"GivenName": first_name, "FamilyName": family_name}, | ||
DisplayName=f"{first_name} {family_name}", | ||
) | ||
assert result is None | ||
|
||
|
||
@patch("integrations.aws.identity_store.execute_aws_api_call") | ||
@patch("integrations.aws.identity_store.resolve_identity_store_id") | ||
def test_get_user_id(mock_resolve_identity_store_id, mock_execute_aws_api_call): | ||
|
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