def test_create(self): """ This tests that allocate adds the runtime_properties.""" ctx = self.mock_ctx('test_create') current_ctx.set(ctx=ctx) args = dict() ebs.create(args, ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
def test_good_snapshot(self): ctx = self.mock_ctx("test_good_snapshot") current_ctx.set(ctx=ctx) args = dict() ebs.create(args, ctx=ctx) args = dict() ebs.create_snapshot(args, ctx=ctx) self.assertIn(constants.VOLUME_SNAPSHOT_ATTRIBUTE, ctx.instance.runtime_properties)
def test_good_snapshot(self): ctx = self.mock_ctx('test_good_snapshot') current_ctx.set(ctx=ctx) args = dict() ebs.create(args, ctx=ctx) args = dict() ebs.create_snapshot(args, ctx=ctx) self.assertIn(constants.VOLUME_SNAPSHOT_ATTRIBUTE, ctx.instance.runtime_properties)
def test_create_with_zone(self): """ This tests that allocate zone is updated with the users zone input.""" zone = "us-east-1b" ctx = self.mock_ctx("test_create_with_zone", zone=zone) current_ctx.set(ctx=ctx) args = {constants.ZONE: zone} ebs.create(args, ctx=ctx) self.assertIn("aws_resource_id", ctx.instance.runtime_properties) self.assertIn(constants.ZONE, ctx.instance.runtime_properties) self.assertEqual(zone, ctx.instance.runtime_properties.get(constants.ZONE))
def test_external_resource(self): """ This tests that create sets the aws_resource_id runtime_properties """ ctx = self.mock_volume_node('test_external_resource') current_ctx.set(ctx=ctx) volume = self.get_volume() ctx.node.properties['use_external_resource'] = True ctx.node.properties['resource_id'] = volume.id args = dict() ebs.create(args, ctx=ctx) self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
def overrided_create_volume(args, **_): ctx.instance.runtime_properties[ctx.node.properties[A4C_RESOURCE_ID_KEY]]= None handle_external_resource() if(ctx.instance.runtime_properties[USE_EXTERNAL_RESOURCE_KEY]): handle_aws_resource_ids() create(args, **_)