def test_make_it(self): sot = security_group.SecurityGroup(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['security_group_rules'], sot.security_group_rules) self.assertEqual('SecurityGroupRule', sot.security_group_rules[0].__class__.__name__)
def test_basic(self): sot = security_group.SecurityGroup() self.assertEqual('security_group', sot.resource_key) self.assertEqual('security_groups', sot.resources_key) self.assertEqual('/security-groups', sot.base_path) self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_fetch) self.assertTrue(sot.allow_commit) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_list)
def test_basic(self): sot = security_group.SecurityGroup() self.assertEqual('security_group', sot.resource_key) self.assertEqual('security_groups', sot.resources_key) self.assertEqual('/security-groups', sot.base_path) self.assertEqual('network', sot.service.service_type) self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_retrieve) self.assertTrue(sot.allow_update) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_list)
def test_make_it(self): sot = security_group.SecurityGroup(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['security_group_rules'], sot.security_group_rules) # TODO(briancurtin): Reevaluate this test upon fixing # https://bugs.launchpad.net/python-openstacksdk/+bug/1423620 # Should be able to test that a rule is a SecurityGroupRule. self.assertEqual(dict, type(sot.security_group_rules[0]))
def test_make_it(self): sot = security_group.SecurityGroup(**EXAMPLE) self.assertEqual(EXAMPLE['created_at'], sot.created_at) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['revision_number'], sot.revision_number) self.assertEqual(EXAMPLE['security_group_rules'], sot.security_group_rules) self.assertEqual(dict, type(sot.security_group_rules[0])) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
def test_basic(self): sot = security_group.SecurityGroup() self.assertEqual('security_group', sot.resource_key) self.assertEqual('security_groups', sot.resources_key) self.assertEqual('/security-groups', sot.base_path) self.assertEqual('network', sot.service.service_type) self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_get) self.assertTrue(sot.allow_update) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_list) self.assertDictEqual( { "description": "description", "name": "name", "limit": "limit", "marker": "marker", "page_reverse": "page_reverse", "project_id": "tenant_id" }, sot._query_mapping._mapping)
def get_security_group(self, **data): return security_group.SecurityGroup(**data).get(self.session)
def create_security_group(self, **data): return security_group.SecurityGroup(data).create(self.session)
def update_security_group(self, **data): return security_group.SecurityGroup(**data).update(self.session)
def delete_security_group(self, **data): return security_group.SecurityGroup(**data).delete(self.session)