Hello community, here is the log from the commit of package python-moto for openSUSE:Factory checked in at 2020-02-19 12:42:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-moto (Old) and /work/SRC/openSUSE:Factory/.python-moto.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-moto" Wed Feb 19 12:42:03 2020 rev:5 rq:775243 version:1.3.14 Changes: -------- --- /work/SRC/openSUSE:Factory/python-moto/python-moto.changes 2019-10-18 14:36:05.115825018 +0200 +++ /work/SRC/openSUSE:Factory/.python-moto.new.26092/python-moto.changes 2020-02-19 12:42:08.699809982 +0100 @@ -1,0 +2,14 @@ +Tue Feb 18 11:39:22 UTC 2020 - Tomáš Chvátal <[email protected]> + +- Update to 1.3.14: + * Support for Python 3.8 + * Many various updates see CHANGELOG.md +- Drop merged patch botocore.patch +- Add patches to build with new botocore: + * dynabodbstreams.patch + * iot-1.patch + * iot-2.patch + * iot-3.patch + * lambdas.patch + +------------------------------------------------------------------- Old: ---- botocore.patch moto-1.3.13.tar.gz New: ---- dynabodbstreams.patch iot-1.patch iot-2.patch iot-3.patch lambdas.patch moto-1.3.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-moto.spec ++++++ --- /var/tmp/diff_new_pack.SjkrpN/_old 2020-02-19 12:42:09.887812269 +0100 +++ /var/tmp/diff_new_pack.SjkrpN/_new 2020-02-19 12:42:09.891812277 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-moto # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,14 +18,18 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-moto -Version: 1.3.13 +Version: 1.3.14 Release: 0 Summary: Library to mock out the boto library License: Apache-2.0 URL: https://github.com/spulec/moto Source: https://files.pythonhosted.org/packages/source/m/moto/moto-%{version}.tar.gz Patch0: unpin-reqs.patch -Patch1: botocore.patch +Patch1: dynabodbstreams.patch +Patch2: iot-1.patch +Patch3: iot-2.patch +Patch4: iot-3.patch +Patch5: lambdas.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -72,6 +76,7 @@ BuildRequires: %{python_module jsonpickle} BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} +BuildRequires: %{python_module parameterized} BuildRequires: %{python_module python-dateutil >= 2.1} BuildRequires: %{python_module python-jose} BuildRequires: %{python_module pytz} @@ -96,6 +101,11 @@ %setup -q -n moto-%{version} %autopatch -p1 +# IOT is too flaky in 1.3.14 release, remove with next one +rm -r tests/test_iot/ +# Lambda tests are flaky in 1.3.14 too, fixed in git master +rm -r tests/test_awslambda/ + %build %python_build @@ -109,7 +119,7 @@ # skipped tests require network connection export BOTO_CONFIG=/dev/null %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} -nosetests-%{$python_bin_suffix} -sv ./tests/ -e "(test_invoke_requestresponse_function|test_context_manager|test_decorator_start_and_stop|test_invoke_function_from_sns)" +nosetests-%{$python_bin_suffix} -sv ./tests/ -e "(test_invoke_requestresponse_function|test_context_manager|test_decorator_start_and_stop|test_invoke_function_from_sns|test_passthrough_requests)" } %post ++++++ dynabodbstreams.patch ++++++ >From 40f241adc212c1c113399534616427d3e2c1d47a Mon Sep 17 00:00:00 2001 From: Steve Pulec <[email protected]> Date: Thu, 21 Nov 2019 17:00:18 -0500 Subject: [PATCH] Fix dynamodb required stream parameter for new boto3. --- tests/test_dynamodbstreams/test_dynamodbstreams.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_dynamodbstreams/test_dynamodbstreams.py b/tests/test_dynamodbstreams/test_dynamodbstreams.py index 01cf915af..e23302022 100644 --- a/tests/test_dynamodbstreams/test_dynamodbstreams.py +++ b/tests/test_dynamodbstreams/test_dynamodbstreams.py @@ -213,7 +213,7 @@ def test_enable_stream_on_table(self): resp = conn.update_table( TableName="test-streams", - StreamSpecification={"StreamViewType": "KEYS_ONLY"}, + StreamSpecification={"StreamViewType": "KEYS_ONLY", "StreamEnabled": True}, ) assert "StreamSpecification" in resp["TableDescription"] assert resp["TableDescription"]["StreamSpecification"] == { @@ -226,7 +226,7 @@ def test_enable_stream_on_table(self): with assert_raises(conn.exceptions.ResourceInUseException): resp = conn.update_table( TableName="test-streams", - StreamSpecification={"StreamViewType": "OLD_IMAGES"}, + StreamSpecification={"StreamViewType": "OLD_IMAGES", "StreamEnabled": True}, ) def test_stream_with_range_key(self): @@ -243,7 +243,7 @@ def test_stream_with_range_key(self): {"AttributeName": "color", "AttributeType": "S"}, ], ProvisionedThroughput={"ReadCapacityUnits": 1, "WriteCapacityUnits": 1}, - StreamSpecification={"StreamViewType": "NEW_IMAGES"}, + StreamSpecification={"StreamViewType": "NEW_IMAGES", "StreamEnabled": True}, ) stream_arn = resp["TableDescription"]["LatestStreamArn"] ++++++ iot-1.patch ++++++ >From 01a593369349a76a01bb9b892d38f92655da0281 Mon Sep 17 00:00:00 2001 From: Chagui- <[email protected]> Date: Thu, 21 Nov 2019 12:32:55 -0300 Subject: [PATCH] -Added group structure in metadata in FakeThingGroup, so that describe_group_thing can return the correct structure -fixed typo inside metadata FakeThingType and FakeThingGroup: creationData -> creationDate --- moto/iot/models.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/moto/iot/models.py b/moto/iot/models.py index 9e520b0fd..b7a613cc3 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -55,7 +55,7 @@ def __init__(self, thing_type_name, thing_type_properties, region_name): self.thing_type_properties = thing_type_properties self.thing_type_id = str(uuid.uuid4()) # I don't know the rule of id t = time.time() - self.metadata = {"deprecated": False, "creationData": int(t * 1000) / 1000.0} + self.metadata = {"deprecated": False, "creationDate": int(t * 1000) / 1000.0} self.arn = "arn:aws:iot:%s:1:thingtype/%s" % (self.region_name, thing_type_name) def to_dict(self): @@ -69,7 +69,7 @@ def to_dict(self): class FakeThingGroup(BaseModel): def __init__( - self, thing_group_name, parent_group_name, thing_group_properties, region_name + self, thing_group_name, parent_group_name, thing_group_properties, region_name, thing_groups ): self.region_name = region_name self.thing_group_name = thing_group_name @@ -78,7 +78,13 @@ def __init__( self.parent_group_name = parent_group_name self.thing_group_properties = thing_group_properties or {} t = time.time() - self.metadata = {"creationData": int(t * 1000) / 1000.0} + self.metadata = {"creationDate": int(t * 1000) / 1000.0} + if parent_group_name: + self.metadata["parentGroupName"] = parent_group_name + self.metadata["rootToParentThingGroups"] = [ + {"groupName": g.thing_group_name, "groupArn": g.arn} + for g in thing_groups + ] self.arn = "arn:aws:iot:%s:1:thinggroup/%s" % ( self.region_name, thing_group_name, @@ -639,6 +645,7 @@ def create_thing_group( parent_group_name, thing_group_properties, self.region_name, + self.thing_groups ) self.thing_groups[thing_group.arn] = thing_group return thing_group.thing_group_name, thing_group.arn, thing_group.thing_group_id ++++++ iot-2.patch ++++++ >From 99781ff7e2fd1fb507aed0e3e011f23ea2c805a7 Mon Sep 17 00:00:00 2001 From: Chagui- <[email protected]> Date: Thu, 21 Nov 2019 12:39:17 -0300 Subject: [PATCH] -Fixed problem with for loop --- moto/iot/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moto/iot/models.py b/moto/iot/models.py index b7a613cc3..b60e38ebf 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -82,8 +82,8 @@ def __init__( if parent_group_name: self.metadata["parentGroupName"] = parent_group_name self.metadata["rootToParentThingGroups"] = [ - {"groupName": g.thing_group_name, "groupArn": g.arn} - for g in thing_groups + {"groupName": group.thing_group_name, "groupArn": group_arn} + for group_arn, group in thing_groups.items() ] self.arn = "arn:aws:iot:%s:1:thinggroup/%s" % ( self.region_name, ++++++ iot-3.patch ++++++ >From f5ba01c867ccc99bcbecd996d52ebf979a2bb5ad Mon Sep 17 00:00:00 2001 From: Chagui- <[email protected]> Date: Thu, 21 Nov 2019 17:16:34 -0300 Subject: [PATCH] -Fixed forever -Added test_describe_thing_group_metadata_hierarchy to test new functionality --- moto/iot/models.py | 20 ++++- tests/test_iot/test_iot.py | 164 +++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+), 4 deletions(-) diff --git a/moto/iot/models.py b/moto/iot/models.py index b60e38ebf..ac098fb87 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -81,10 +81,22 @@ def __init__( self.metadata = {"creationDate": int(t * 1000) / 1000.0} if parent_group_name: self.metadata["parentGroupName"] = parent_group_name - self.metadata["rootToParentThingGroups"] = [ - {"groupName": group.thing_group_name, "groupArn": group_arn} - for group_arn, group in thing_groups.items() - ] + #initilize rootToParentThingGroups + if 'rootToParentThingGroups' not in self.metadata: + self.metadata["rootToParentThingGroups"] = [] + #search for parent arn + for thing_group_arn, thing_group in thing_groups.items(): + if thing_group.thing_group_name == parent_group_name: + parent_thing_group_structure = thing_group + break + #if parent arn found (should always be found) + if (parent_thing_group_structure): + # copy parent's rootToParentThingGroups + if "rootToParentThingGroups" in parent_thing_group_structure.metadata: + self.metadata["rootToParentThingGroups"].extend(parent_thing_group_structure.metadata["rootToParentThingGroups"]) + self.metadata["rootToParentThingGroups"].extend([ + {"groupName": parent_group_name, "groupArn": parent_thing_group_structure.arn} + ]) self.arn = "arn:aws:iot:%s:1:thinggroup/%s" % ( self.region_name, thing_group_name, diff --git a/tests/test_iot/test_iot.py b/tests/test_iot/test_iot.py index 713dc2977..c3612d46f 100644 --- a/tests/test_iot/test_iot.py +++ b/tests/test_iot/test_iot.py @@ -581,6 +581,170 @@ def test_delete_principal_thing(): client.delete_certificate(certificateId=cert_id) +@mock_iot +def test_describe_thing_group_metadata_hierarchy(): + client = boto3.client("iot", region_name="ap-northeast-1") + group_name_1a = "my-group-name-1a" + group_name_1b = "my-group-name-1b" + group_name_2a = "my-group-name-2a" + group_name_2b = "my-group-name-2b" + group_name_3a = "my-group-name-3a" + group_name_3b = "my-group-name-3b" + group_name_3c = "my-group-name-3c" + group_name_3d = "my-group-name-3d" + + # --1a + # |--2a + # | |--3a + # | |--3b + # | + # |--2b + # |--3c + # |--3d + # --1b + + # create thing groups tree + # 1 + thing_group1a = client.create_thing_group(thingGroupName=group_name_1a) + thing_group1a.should.have.key("thingGroupName").which.should.equal(group_name_1a) + thing_group1a.should.have.key("thingGroupArn") + thing_group1b = client.create_thing_group(thingGroupName=group_name_1b) + thing_group1b.should.have.key("thingGroupName").which.should.equal(group_name_1b) + thing_group1b.should.have.key("thingGroupArn") + # 2 + thing_group2a = client.create_thing_group( + thingGroupName=group_name_2a, parentGroupName=group_name_1a + ) + thing_group2a.should.have.key("thingGroupName").which.should.equal(group_name_2a) + thing_group2a.should.have.key("thingGroupArn") + thing_group2b = client.create_thing_group( + thingGroupName=group_name_2b, parentGroupName=group_name_1a + ) + thing_group2b.should.have.key("thingGroupName").which.should.equal(group_name_2b) + thing_group2b.should.have.key("thingGroupArn") + # 3 + thing_group3a = client.create_thing_group( + thingGroupName=group_name_3a, parentGroupName=group_name_2a + ) + thing_group3a.should.have.key("thingGroupName").which.should.equal(group_name_3a) + thing_group3a.should.have.key("thingGroupArn") + thing_group3b = client.create_thing_group( + thingGroupName=group_name_3b, parentGroupName=group_name_2a + ) + thing_group3b.should.have.key("thingGroupName").which.should.equal(group_name_3b) + thing_group3b.should.have.key("thingGroupArn") + thing_group3c = client.create_thing_group( + thingGroupName=group_name_3c, parentGroupName=group_name_2b + ) + thing_group3c.should.have.key("thingGroupName").which.should.equal(group_name_3c) + thing_group3c.should.have.key("thingGroupArn") + thing_group3d = client.create_thing_group( + thingGroupName=group_name_3d, parentGroupName=group_name_2b + ) + thing_group3d.should.have.key("thingGroupName").which.should.equal(group_name_3d) + thing_group3d.should.have.key("thingGroupArn") + + # describe groups + # groups level 1 + # 1a + thing_group_description1a = client.describe_thing_group(thingGroupName=group_name_1a) + thing_group_description1a.should.have.key("thingGroupName").which.should.equal(group_name_1a) + thing_group_description1a.should.have.key("thingGroupProperties") + thing_group_description1a.should.have.key("thingGroupMetadata") + thing_group_description1a["thingGroupMetadata"].should.have.key("creationDate") + thing_group_description1a.should.have.key("version") + # 1b + thing_group_description1b = client.describe_thing_group(thingGroupName=group_name_1b) + thing_group_description1b.should.have.key("thingGroupName").which.should.equal(group_name_1b) + thing_group_description1b.should.have.key("thingGroupProperties") + thing_group_description1b.should.have.key("thingGroupMetadata") + thing_group_description1b["thingGroupMetadata"].should.have.length_of(1) + thing_group_description1b["thingGroupMetadata"].should.have.key("creationDate") + thing_group_description1b.should.have.key("version") + # groups level 2 + # 2a + thing_group_description2a = client.describe_thing_group(thingGroupName=group_name_2a) + thing_group_description2a.should.have.key("thingGroupName").which.should.equal(group_name_2a) + thing_group_description2a.should.have.key("thingGroupProperties") + thing_group_description2a.should.have.key("thingGroupMetadata") + thing_group_description2a["thingGroupMetadata"].should.have.length_of(3) + thing_group_description2a["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_1a) + thing_group_description2a["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description2a["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(1) + thing_group_description2a["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description2a["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description2a.should.have.key("version") + # 2b + thing_group_description2b = client.describe_thing_group(thingGroupName=group_name_2b) + thing_group_description2b.should.have.key("thingGroupName").which.should.equal(group_name_2b) + thing_group_description2b.should.have.key("thingGroupProperties") + thing_group_description2b.should.have.key("thingGroupMetadata") + thing_group_description2b["thingGroupMetadata"].should.have.length_of(3) + thing_group_description2b["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_1a) + thing_group_description2b["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description2b["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(1) + thing_group_description2b["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description2b["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description2b.should.have.key("version") + # groups level 3 + # 3a + thing_group_description3a = client.describe_thing_group(thingGroupName=group_name_3a) + thing_group_description3a.should.have.key("thingGroupName").which.should.equal(group_name_3a) + thing_group_description3a.should.have.key("thingGroupProperties") + thing_group_description3a.should.have.key("thingGroupMetadata") + thing_group_description3a["thingGroupMetadata"].should.have.length_of(3) + thing_group_description3a["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_2a) + thing_group_description3a["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(2) + thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupName'].should.match(group_name_2a) + thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupArn'].should.match(thing_group2a['thingGroupArn']) + thing_group_description3a.should.have.key("version") + # 3b + thing_group_description3b = client.describe_thing_group(thingGroupName=group_name_3b) + thing_group_description3b.should.have.key("thingGroupName").which.should.equal(group_name_3b) + thing_group_description3b.should.have.key("thingGroupProperties") + thing_group_description3b.should.have.key("thingGroupMetadata") + thing_group_description3b["thingGroupMetadata"].should.have.length_of(3) + thing_group_description3b["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_2a) + thing_group_description3b["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(2) + thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupName'].should.match(group_name_2a) + thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupArn'].should.match(thing_group2a['thingGroupArn']) + thing_group_description3b.should.have.key("version") + # 3c + thing_group_description3c = client.describe_thing_group(thingGroupName=group_name_3c) + thing_group_description3c.should.have.key("thingGroupName").which.should.equal(group_name_3c) + thing_group_description3c.should.have.key("thingGroupProperties") + thing_group_description3c.should.have.key("thingGroupMetadata") + thing_group_description3c["thingGroupMetadata"].should.have.length_of(3) + thing_group_description3c["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_2b) + thing_group_description3c["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(2) + thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupName'].should.match(group_name_2b) + thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupArn'].should.match(thing_group2b['thingGroupArn']) + thing_group_description3c.should.have.key("version") + # 3d + thing_group_description3d = client.describe_thing_group(thingGroupName=group_name_3d) + thing_group_description3d.should.have.key("thingGroupName").which.should.equal(group_name_3d) + thing_group_description3d.should.have.key("thingGroupProperties") + thing_group_description3d.should.have.key("thingGroupMetadata") + thing_group_description3d["thingGroupMetadata"].should.have.length_of(3) + thing_group_description3d["thingGroupMetadata"].should.have.key("parentGroupName").being.equal(group_name_2b) + thing_group_description3d["thingGroupMetadata"].should.have.key('rootToParentThingGroups') + thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"].should.have.length_of(2) + thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupName'].should.match(group_name_1a) + thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][0]['groupArn'].should.match(thing_group1a['thingGroupArn']) + thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupName'].should.match(group_name_2b) + thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][1]['groupArn'].should.match(thing_group2b['thingGroupArn']) + thing_group_description3d.should.have.key("version") + + @mock_iot def test_thing_groups(): client = boto3.client("iot", region_name="ap-northeast-1") ++++++ lambdas.patch ++++++ >From bd777cad44dc0c0ec979c366fce228429d182e2f Mon Sep 17 00:00:00 2001 From: Mike Grima <[email protected]> Date: Sun, 17 Nov 2019 23:16:15 -0800 Subject: [PATCH] Fix for moto not unmocking. - Fixes #2575 - Also upgraded Travis CI to make use of Bionic instead of Xenial - This may also address concerns raised in #1793 --- moto/core/models.py | 3 ++ tests/test_awslambda/test_lambda.py | 40 +++++++++---------- tests/test_dynamodb2/test_dynamodb.py | 12 +++--- .../test_stepfunctions/test_stepfunctions.py | 2 +- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/moto/core/models.py b/moto/core/models.py index e0eae5858..5b19137c3 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -44,6 +44,7 @@ def __init__(self, backends): "AWS_ACCESS_KEY_ID": "foobar_key", "AWS_SECRET_ACCESS_KEY": "foobar_secret", } + self.default_session_mock = mock.patch("boto3.DEFAULT_SESSION", None) self.env_variables_mocks = mock.patch.dict(os.environ, FAKE_KEYS) if self.__class__.nested_count == 0: @@ -62,6 +63,7 @@ def __exit__(self, *args): self.stop() def start(self, reset=True): + self.default_session_mock.start() self.env_variables_mocks.start() self.__class__.nested_count += 1 @@ -72,6 +74,7 @@ def start(self, reset=True): self.enable_patching() def stop(self): + self.default_session_mock.stop() self.env_variables_mocks.stop() self.__class__.nested_count -= 1 diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index 6b3d489ca..5d66b1537 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -1001,10 +1001,10 @@ def test_list_versions_by_function_for_nonexistent_function(): @mock_lambda @mock_sqs def test_create_event_source_mapping(): - sqs = boto3.resource("sqs") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1030,11 +1030,11 @@ def test_create_event_source_mapping(): @mock_lambda @mock_sqs def test_invoke_function_from_sqs(): - logs_conn = boto3.client("logs") - sqs = boto3.resource("sqs") + logs_conn = boto3.client("logs", region_name="us-east-1") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1054,7 +1054,7 @@ def test_invoke_function_from_sqs(): assert response["EventSourceArn"] == queue.attributes["QueueArn"] assert response["State"] == "Enabled" - sqs_client = boto3.client("sqs") + sqs_client = boto3.client("sqs", region_name="us-east-1") sqs_client.send_message(QueueUrl=queue.url, MessageBody="test") start = time.time() while (time.time() - start) < 30: @@ -1081,8 +1081,8 @@ def test_invoke_function_from_sqs(): @mock_lambda @mock_dynamodb2 def test_invoke_function_from_dynamodb(): - logs_conn = boto3.client("logs") - dynamodb = boto3.client("dynamodb") + logs_conn = boto3.client("logs", region_name="us-east-1") + dynamodb = boto3.client("dynamodb", region_name="us-east-1") table_name = "table_with_stream" table = dynamodb.create_table( TableName=table_name, @@ -1094,7 +1094,7 @@ def test_invoke_function_from_dynamodb(): }, ) - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1141,11 +1141,11 @@ def test_invoke_function_from_dynamodb(): @mock_lambda @mock_sqs def test_invoke_function_from_sqs_exception(): - logs_conn = boto3.client("logs") - sqs = boto3.resource("sqs") + logs_conn = boto3.client("logs", region_name="us-east-1") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1201,10 +1201,10 @@ def test_invoke_function_from_sqs_exception(): @mock_lambda @mock_sqs def test_list_event_source_mappings(): - sqs = boto3.resource("sqs") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1233,10 +1233,10 @@ def test_list_event_source_mappings(): @mock_lambda @mock_sqs def test_get_event_source_mapping(): - sqs = boto3.resource("sqs") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1263,10 +1263,10 @@ def test_get_event_source_mapping(): @mock_lambda @mock_sqs def test_update_event_source_mapping(): - sqs = boto3.resource("sqs") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func1 = conn.create_function( FunctionName="testFunction", Runtime="python2.7", @@ -1307,10 +1307,10 @@ def test_update_event_source_mapping(): @mock_lambda @mock_sqs def test_delete_event_source_mapping(): - sqs = boto3.resource("sqs") + sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName="test-sqs-queue1") - conn = boto3.client("lambda") + conn = boto3.client("lambda", region_name="us-east-1") func1 = conn.create_function( FunctionName="testFunction", Runtime="python2.7", diff --git a/tests/test_dynamodb2/test_dynamodb.py b/tests/test_dynamodb2/test_dynamodb.py index 7f6963870..2b0833d98 100644 --- a/tests/test_dynamodb2/test_dynamodb.py +++ b/tests/test_dynamodb2/test_dynamodb.py @@ -3119,8 +3119,8 @@ def create_item(price): # https://github.com/spulec/moto/issues/1874 @mock_dynamodb2 def test_item_size_is_under_400KB(): - dynamodb = boto3.resource("dynamodb") - client = boto3.client("dynamodb") + dynamodb = boto3.resource("dynamodb", region_name="us-east-1") + client = boto3.client("dynamodb", region_name="us-east-1") dynamodb.create_table( TableName="moto-test", @@ -3172,7 +3172,7 @@ def assert_failure_due_to_item_size(func, **kwargs): @mock_dynamodb2 # https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression def test_hash_key_cannot_use_begins_with_operations(): - dynamodb = boto3.resource("dynamodb") + dynamodb = boto3.resource("dynamodb", region_name="us-east-1") table = dynamodb.create_table( TableName="test-table", KeySchema=[{"AttributeName": "key", "KeyType": "HASH"}], @@ -3201,7 +3201,7 @@ def test_hash_key_cannot_use_begins_with_operations(): @mock_dynamodb2 def test_update_supports_complex_expression_attribute_values(): - client = boto3.client("dynamodb") + client = boto3.client("dynamodb", region_name="us-east-1") client.create_table( AttributeDefinitions=[{"AttributeName": "SHA256", "AttributeType": "S"}], @@ -3237,7 +3237,7 @@ def test_update_supports_complex_expression_attribute_values(): @mock_dynamodb2 def test_update_supports_list_append(): - client = boto3.client("dynamodb") + client = boto3.client("dynamodb", region_name="us-east-1") client.create_table( AttributeDefinitions=[{"AttributeName": "SHA256", "AttributeType": "S"}], @@ -3272,7 +3272,7 @@ def test_update_supports_list_append(): @mock_dynamodb2 def test_update_catches_invalid_list_append_operation(): - client = boto3.client("dynamodb") + client = boto3.client("dynamodb", region_name="us-east-1") client.create_table( AttributeDefinitions=[{"AttributeName": "SHA256", "AttributeType": "S"}], diff --git a/tests/test_stepfunctions/test_stepfunctions.py b/tests/test_stepfunctions/test_stepfunctions.py index 77b9fbfb3..6c391f0d1 100644 --- a/tests/test_stepfunctions/test_stepfunctions.py +++ b/tests/test_stepfunctions/test_stepfunctions.py @@ -524,7 +524,7 @@ def _get_account_id(): global account_id if account_id: return account_id - sts = boto3.client("sts") + sts = boto3.client("sts", region_name=region) identity = sts.get_caller_identity() account_id = identity["Account"] return account_id ++++++ moto-1.3.13.tar.gz -> moto-1.3.14.tar.gz ++++++ ++++ 167326 lines of diff (skipped)
