def test_good_address_release(self):
        """ This tests that release unsets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_ctx('test_good_address_delete')
        current_ctx.set(ctx=ctx)
        address = self.get_address()
        ctx.instance.runtime_properties['aws_resource_id'] = \
            address.public_ip
        elasticip.release(ctx=ctx)
        self.assertNotIn('aws_resource_id',
                         ctx.instance.runtime_properties.keys())
    def test_release_existing(self):
        """ Tests that release actually releases.
        """

        ctx = self.mock_ctx('test_release_existing')
        current_ctx.set(ctx=ctx)
        address = self.get_address()
        ctx.instance.runtime_properties['aws_resource_id'] = \
            address.public_ip
        ctx.node.properties['use_external_resource'] = True
        elasticip.release(ctx=ctx)
        self.assertNotIn(
            'aws_resource_id', ctx.instance.runtime_properties.keys())
        ec2_client = self.get_client()
        self.assertIsNotNone(ec2_client.get_all_addresses(address.public_ip))