From 78d7d73e4165321d6fef65c1f891636c6c0cb33f Mon Sep 17 00:00:00 2001 From: Andrea Tartaglia Date: Fri, 27 Sep 2024 10:04:46 +0200 Subject: [PATCH] update unit tests to account for ImdsSupport calls --- tests/unit/plugins/modules/test_ec2_ami.py | 2 +- tests/unit/plugins/modules/test_ec2_ami_info.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/plugins/modules/test_ec2_ami.py b/tests/unit/plugins/modules/test_ec2_ami.py index dfec225e24..bc5e9a65b8 100644 --- a/tests/unit/plugins/modules/test_ec2_ami.py +++ b/tests/unit/plugins/modules/test_ec2_ami.py @@ -63,7 +63,7 @@ def test_get_image_by_id_found(m_describe_images, m_describe_image_attribute): image = ec2_ami.get_image_by_id(connection, "ami-0c7a795306730b288") assert image["ImageId"] == "ami-0c7a795306730b288" assert m_describe_images.call_count == 1 - assert m_describe_image_attribute.call_count == 2 + assert m_describe_image_attribute.call_count == 3 m_describe_images.assert_has_calls( [ call( diff --git a/tests/unit/plugins/modules/test_ec2_ami_info.py b/tests/unit/plugins/modules/test_ec2_ami_info.py index 087c55077c..12c7e175ac 100644 --- a/tests/unit/plugins/modules/test_ec2_ami_info.py +++ b/tests/unit/plugins/modules/test_ec2_ami_info.py @@ -160,11 +160,15 @@ def test_list_ec2_images(m_get_images, m_describe_image_attribute): assert m_get_images.call_count == 1 m_get_images.assert_called_with(ec2_client, request_args) - assert m_describe_image_attribute.call_count == 2 + assert m_describe_image_attribute.call_count == 4 m_describe_image_attribute.assert_has_calls( [call(ec2_client, attribute="launchPermission", image_id=images[0]["image_id"])], [call(ec2_client, attribute="launchPermission", image_id=images[1]["image_id"])], ) + m_describe_image_attribute.assert_has_calls( + [call(ec2_client, attribute="ImdsSupport", image_id=images[0]["image_id"])], + [call(ec2_client, attribute="ImdsSupport", image_id=images[1]["image_id"])], + ) assert len(list_ec2_images_result) == 2 assert list_ec2_images_result[0]["image_id"] == "ami-1234567890"