Fix list_job_excecutions_for_thing with status parameter (#4334)

This commit is contained in:
Fabian Iffländer 2021-09-24 15:41:08 +02:00 committed by GitHub
parent 579b6e264f
commit a02bf0022d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -1306,7 +1306,7 @@ class IoTBackend(BaseBackend):
if status is not None: if status is not None:
job_executions = list( job_executions = list(
filter( filter(
lambda elem: status in elem["status"] and elem["status"] == status, lambda elem: elem["jobExecutionSummary"].get("status") == status,
job_executions, job_executions,
) )
) )
@ -1338,7 +1338,7 @@ class IoTBackend(BaseBackend):
if status is not None: if status is not None:
job_executions = list( job_executions = list(
filter( filter(
lambda elem: status in elem["status"] and elem["status"] == status, lambda elem: elem["jobExecutionSummary"].get("status") == status,
job_executions, job_executions,
) )
) )

View File

@ -2011,6 +2011,12 @@ def test_list_job_executions_for_job():
"thingArn" "thingArn"
).which.should.equal(thing["thingArn"]) ).which.should.equal(thing["thingArn"])
job_execution = client.list_job_executions_for_job(jobId=job_id, status="QUEUED")
job_execution.should.have.key("executionSummaries")
job_execution["executionSummaries"][0].should.have.key(
"thingArn"
).which.should.equal(thing["thingArn"])
@mock_iot @mock_iot
def test_list_job_executions_for_thing(): def test_list_job_executions_for_thing():
@ -2048,6 +2054,14 @@ def test_list_job_executions_for_thing():
job_id job_id
) )
job_execution = client.list_job_executions_for_thing(
thingName=name, status="QUEUED"
)
job_execution.should.have.key("executionSummaries")
job_execution["executionSummaries"][0].should.have.key("jobId").which.should.equal(
job_id
)
class TestTopicRules: class TestTopicRules:
name = "my-rule" name = "my-rule"