Core: Allow same request to be made multiple times (#5837)

This commit is contained in:
Bert Blommers 2023-01-12 12:11:27 +00:00 committed by GitHub
parent 5d2f2bca8c
commit 79616e11e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -43,18 +43,13 @@ class BotocoreStubber:
response = None
response_callback = None
found_index = None
matchers = self.methods.get(request.method)
matchers = self.methods.get(request.method, [])
base_url = request.url.split("?", 1)[0]
for i, (pattern, callback) in enumerate(matchers): # type: ignore[arg-type]
for pattern, callback in matchers:
if pattern.match(base_url):
if found_index is None:
found_index = i
response_callback = callback
else:
matchers.pop(found_index)
break
response_callback = callback
break
if response_callback is not None:
for header, value in request.headers.items():

View File

@ -33,6 +33,10 @@ def test_attach_policy(iot_client, policy):
res.should.have.key("policies").which.should.have.length_of(1)
res["policies"][0]["policyName"].should.equal("my-policy")
res = iot_client.list_attached_policies(target=cert_arn)
res.should.have.key("policies").which.should.have.length_of(1)
res["policies"][0]["policyName"].should.equal("my-policy")
@mock_cognitoidentity
def test_attach_policy_to_identity(region_name, iot_client, policy):