def test_release(self, ec2_client): # pylint: disable=no-self-use with patch("sdcm.utils.common.list_elastic_ips_aws", return_value={"eu-north-1": [{ "AssociationId": 2222, "AllocationId": 3333, "PublicIp": '127.0.0.1', }]}) as list_elastic_ips_aws: clean_elastic_ips_aws({"TestId": 1111, }) list_elastic_ips_aws.assert_called_with(tags_dict={"TestId": 1111, }, group_as_region=True) ec2_client().disassociate_address.assert_called_once_with(AssociationId=2222) ec2_client().release_address.assert_called_once_with(AllocationId=3333)
def test_empty_list(self, ec2_client): # pylint: disable=no-self-use with patch("sdcm.utils.common.list_elastic_ips_aws", return_value={}) as list_elastic_ips_aws: clean_elastic_ips_aws({ "TestId": 1111, }) list_elastic_ips_aws.assert_called_with(tags_dict={ "TestId": 1111, }, group_as_region=True) ec2_client().disassociate_address.assert_not_called() ec2_client().release_address.assert_not_called()