From d6bec75e4379d118f13038f3f04e7bc9f7e0099f Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Thu, 31 Mar 2022 11:40:06 +0000 Subject: [PATCH] ELBV2 - Ensure ResourceARN is returned when describing tags (#4990) --- moto/elbv2/responses.py | 4 ++-- tests/test_elbv2/test_elbv2.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py index 8b97cae70..e9a53d495 100644 --- a/moto/elbv2/responses.py +++ b/moto/elbv2/responses.py @@ -635,9 +635,9 @@ REMOVE_TAGS_TEMPLATE = """ - {% for resource, tags in resource_tags.items() %} + {% for resource_arn, tags in resource_tags.items() %} - {{ resource.arn }} + {{ resource_arn }} {% for key, value in tags.items() %} diff --git a/tests/test_elbv2/test_elbv2.py b/tests/test_elbv2/test_elbv2.py index 89924e57b..e70346ca2 100644 --- a/tests/test_elbv2/test_elbv2.py +++ b/tests/test_elbv2/test_elbv2.py @@ -30,10 +30,12 @@ def test_create_load_balancer(): ) lb.get("CreatedTime").tzinfo.should_not.be.none lb.get("State").get("Code").should.equal("provisioning") + lb_arn = lb.get("LoadBalancerArn") # Ensure the tags persisted - response = conn.describe_tags(ResourceArns=[lb.get("LoadBalancerArn")]) - tags = {d["Key"]: d["Value"] for d in response["TagDescriptions"][0]["Tags"]} + tag_desc = conn.describe_tags(ResourceArns=[lb_arn])["TagDescriptions"][0] + tag_desc.should.have.key("ResourceArn").equals(lb_arn) + tags = {d["Key"]: d["Value"] for d in tag_desc["Tags"]} tags.should.equal({"key_name": "a_value"})