def test_create(self): """This tests that create runs""" test_properties = self.get_mock_properties() ctx = self.security_group_mock('test_create', test_properties) current_ctx.set(ctx=ctx) securitygroup.create(ctx=ctx)
def test_create_retry(self): """This tests that create retry works""" test_properties = self.get_mock_properties() ctx = self.security_group_mock('test_create_retry', test_properties, retry_number=1) current_ctx.set(ctx=ctx) name = ctx.node.properties.get('resource_id') description = ctx.node.properties.get('description') ec2_client = connection.EC2ConnectionClient().client() group = ec2_client.create_security_group(name, description) ctx.instance.runtime_properties[constants.EXTERNAL_RESOURCE_ID] = \ group.id securitygroup.create(ctx=ctx)
def test_create_existing(self): """This tests that create creates the runtime_properties""" test_properties = self.get_mock_properties() ctx = self.security_group_mock('test_create_duplicate', test_properties) current_ctx.set(ctx=ctx) name = ctx.node.properties.get('resource_id') description = ctx.node.properties.get('description') ec2_client = connection.EC2ConnectionClient().client() group = ec2_client.create_security_group(name, description) ctx.node.properties['use_external_resource'] = True securitygroup.create(ctx=ctx) self.assertEqual(ctx.instance.runtime_properties['aws_resource_id'], group.id)
def test_create_existing(self): """This tests that create creates the runtime_properties""" test_properties = self.get_mock_properties() ctx = self.security_group_mock( 'test_create_duplicate', test_properties) current_ctx.set(ctx=ctx) name = ctx.node.properties.get('resource_id') description = ctx.node.properties.get('description') ec2_client = connection.EC2ConnectionClient().client() group = ec2_client.create_security_group(name, description) ctx.node.properties['use_external_resource'] = True securitygroup.create(ctx=ctx) self.assertEqual( ctx.instance.runtime_properties['aws_resource_id'], group.id)