From 1777753abad91a04da80889748dff753c574a043 Mon Sep 17 00:00:00 2001 From: Benjamin Gill Date: Tue, 11 May 2021 17:38:55 +0100 Subject: [PATCH] Update tests for moto 2 Need to change our test fixtures to match up with the changes since 1.3.6. --- .secrets.baseline | 6 +++--- tests/test_s3.py | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 7e673899..60f03ecc 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": null, "lines": null }, - "generated_at": "2021-02-10T17:15:51Z", + "generated_at": "2021-05-11T16:38:44Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -234,14 +234,14 @@ "hashed_secret": "a74dcad10ebcdbad1049f116bc34fe5bf5f91ed8", "is_secret": false, "is_verified": false, - "line_number": 21, + "line_number": 24, "type": "Secret Keyword" }, { "hashed_secret": "8fd17a4f88a78455ef94e43c20e2a78826ce8138", "is_secret": false, "is_verified": false, - "line_number": 113, + "line_number": 165, "type": "AWS Access Key" } ] diff --git a/tests/test_s3.py b/tests/test_s3.py index 33d89188..0d618947 100644 --- a/tests/test_s3.py +++ b/tests/test_s3.py @@ -17,13 +17,12 @@ @pytest.yield_fixture def s3_mock(request, os_environ): + m = mock_s3() # we don't want any real aws credentials this environment might have used in the tests - os_environ.update({ + m.FAKE_KEYS.update({ "AWS_ACCESS_KEY_ID": "AKIAIABCDABCDABCDABC", "AWS_SECRET_ACCESS_KEY": "foobarfoobarfoobarfoobarfoobarfoobarfoob", }) - - m = mock_s3() m.start() yield m m.stop() @@ -32,8 +31,7 @@ def s3_mock(request, os_environ): @pytest.yield_fixture def empty_bucket(request, s3_mock): s3_res = boto3.resource("s3", region_name=default_region) - bucket = s3_res.Bucket("dear-liza") - bucket.create() + bucket = s3_res.create_bucket(Bucket="dear-liza", CreateBucketConfiguration={'LocationConstraint': default_region}) yield bucket