Created
September 13, 2022 01:21
-
-
Save gsweene2/4a282d06e107ed2017ce53e500d2149f to your computer and use it in GitHub Desktop.
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
def test_get_bucket_contents_and_get_table_details_from_clients__when_bucket_exists_and_able_exists__should_return_correctly(): | |
# Arrange | |
# Mock the s3_client with a return value on chained method calls | |
mock_s3_util = MagicMock() | |
mock_s3_util.list_objects.return_value = ["Some Object", "Another Object"] | |
mock_dynamo_util = MagicMock() | |
mock_dynamo_util.describe_table.return_value = {"TableName": "string"} | |
# Act | |
r = main.get_bucket_contents_and_get_table_details_from_clients(mock_s3_util, mock_dynamo_util) | |
# Assert | |
print(f"Calls to mock_s3_util: {mock_s3_util.list_objects.call_args_list}") | |
mock_s3_util.list_objects.assert_called_with('garretts-sample-bucket') | |
mock_dynamo_util.describe_table.assert_called_with("blob-my-infra-dev") | |
assert (["Some Object", "Another Object"], {"TableName": "string"}) == r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment