From c75d418e2ef24416f62a56bfe27b46b47791a774 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 10 Nov 2021 19:33:32 -0800 Subject: [PATCH] Don't stringify, parameter order broken on Python 3.7 --- tests/test_s3_credentials.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/test_s3_credentials.py b/tests/test_s3_credentials.py index 8eb8369..0afb5fe 100644 --- a/tests/test_s3_credentials.py +++ b/tests/test_s3_credentials.py @@ -406,18 +406,24 @@ def test_create_duration( ' "SessionToken": "session"\n' "}\n" ) - assert [str(c) for c in mocked_for_duration.mock_calls] == [ - "call('s3')", - "call('iam')", - "call('sts')", - "call().head_bucket(Bucket='pytest-bucket-simonw-1')", - "call().get_caller_identity()", - "call().get_role(RoleName='s3-credentials.AmazonS3FullAccess')", - "call().assume_role(RoleArn='arn:::role', RoleSessionName='s3.{fragment}.pytest-bucket-simonw-1', Policy='{policy}', DurationSeconds=900)".format( - fragment=expected_name_fragment, - policy=expected_policy.replace( - "$!BUCKET_NAME!$", "pytest-bucket-simonw-1" + assert mocked_for_duration.mock_calls == [ + call("s3"), + call("iam"), + call("sts"), + call().head_bucket(Bucket="pytest-bucket-simonw-1"), + call().get_caller_identity(), + call().get_role(RoleName="s3-credentials.AmazonS3FullAccess"), + call().assume_role( + RoleArn="arn:::role", + RoleSessionName="s3.{fragment}.pytest-bucket-simonw-1".format( + fragment=expected_name_fragment ), + Policy="{policy}".format( + policy=expected_policy.replace( + "$!BUCKET_NAME!$", "pytest-bucket-simonw-1" + ), + ), + DurationSeconds=900, ), ]