def test_allocate(self): """ This tests that allocate adds the runtime_properties.""" ctx = self.mock_ctx('test_allocate') current_ctx.set(ctx=ctx) elasticip.allocate(ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
def test_allocate_backward_compatibility(self): """ This tests that allocate adds the runtime_properties.""" ctx = self.mock_ctx('test_allocate') del ctx.node.properties['domain'] current_ctx.set(ctx=ctx) elasticip.allocate(ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
def test_external_resource(self): """ This tests that allocate sets the aws_resource_id runtime_properties """ ctx = self.mock_elastic_ip_node('test_external_resource') current_ctx.set(ctx=ctx) address = self.get_address() ctx.node.properties['use_external_resource'] = True ctx.node.properties['resource_id'] = address.public_ip elasticip.allocate(ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
def test_allocate_vpc(self): """ This tests that allocate and vpc adds the runtime_properties.""" ctx = self.mock_ctx('test_allocate_vpc') vpc = self.create_vpc_client().create_vpc('10.10.10.0/16') ctx.provider_context['resources'] = { constants.VPC: { 'id': vpc.id, 'external_resource': True } } current_ctx.set(ctx=ctx) elasticip.allocate(ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)