def test_get_all_security_groups(self): ctx = self.mock_cloudify_context('test_get_all_security_groups') current_ctx.set(ctx=ctx) client = self._get_ec2_client() groups_from_test = client.get_all_security_groups() groups_from_plugin = securitygroup._get_all_security_groups() self.assertEqual(len(groups_from_test), len(groups_from_plugin))
def test_get_all_security_groups_not_found(self): ctx = self.mock_cloudify_context( 'test_get_all_security_groups_not_found') current_ctx.set(ctx=ctx) not_found_names = ['test_get_all_security_groups_not_found'] groups_from_plugin = securitygroup._get_all_security_groups( list_of_group_names=not_found_names) self.assertIsNone(groups_from_plugin)
def test_get_all_security_groups(self): ctx = self.mock_cloudify_context( 'test_get_all_security_groups') current_ctx.set(ctx=ctx) client = self._get_ec2_client() groups_from_test = client.get_all_security_groups() groups_from_plugin = securitygroup._get_all_security_groups() self.assertEqual(len(groups_from_test), len(groups_from_plugin))
def test_get_all_groups(self): """ This tests that all created groups are returned by _get_all_security_groups """ test_properties = self.get_mock_properties() ctx = self.security_group_mock('test_get_all_groups', test_properties) current_ctx.set(ctx=ctx) ec2_client = connection.EC2ConnectionClient().client() group = ec2_client.create_security_group('test_get_all_groups', 'this is test') ctx.instance.runtime_properties['aws_resource_id'] = group.id output = securitygroup._get_all_security_groups( list_of_group_ids=group.id) self.assertEqual(output[0].id, group.id)
def test_get_all_groups(self): """ This tests that all created groups are returned by _get_all_security_groups """ test_properties = self.get_mock_properties() ctx = self.security_group_mock( 'test_get_all_groups', test_properties) current_ctx.set(ctx=ctx) ec2_client = connection.EC2ConnectionClient().client() group = ec2_client.create_security_group('test_get_all_groups', 'this is test') ctx.instance.runtime_properties['aws_resource_id'] = group.id output = securitygroup._get_all_security_groups( list_of_group_ids=group.id) self.assertEqual(output[0].id, group.id)