diff options
author | WuKong <rebirthmonkey@gmail.com> | 2015-07-16 18:06:45 +0200 |
---|---|---|
committer | WuKong <rebirthmonkey@gmail.com> | 2015-07-16 18:06:45 +0200 |
commit | 0e4a78d142013af0d1530db688350a83d5d65051 (patch) | |
tree | b8ec692967bff0ef7ceeca24ea6f72ae214b22fd /keystone-moon/keystone/tests | |
parent | c10edf3198cda970331bdf6b60166aa8fb611888 (diff) |
reivew code
Change-Id: I912698ca09a6c1161c02502a7ea551a5ee905949
Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'keystone-moon/keystone/tests')
4 files changed, 15 insertions, 15 deletions
diff --git a/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_admin.py b/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_admin.py index 0e5d69d4..0b7c1d21 100644 --- a/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_admin.py +++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_admin.py @@ -65,7 +65,7 @@ class TestIntraExtensionAdminManagerOK(tests.TestCase): #self.admin = self.identity_api.create_user(USER) IE["policymodel"] = policy_model IE["name"] = uuid.uuid4().hex - self.ref = self.manager.load_intra_extension(IE) + self.ref = self.manager.load_intra_extension_dict(IE) self.assertIsInstance(self.ref, dict) self.create_tenant(self.ref["id"]) @@ -1170,7 +1170,7 @@ class TestIntraExtensionAdminManagerOK(tests.TestCase): self.assertEqual(self.ref["id"], subject_categories["intra_extension_uuid"]) self.assertIn(new_subject_category["id"], subject_categories["subject_categories"]) metarule[relation]["subject_categories"].append(new_subject_category["id"]) - _sub_meta_rules = self.manager.set_sub_meta_rule_dict("admin", self.ref["id"], metarule) + _sub_meta_rules = self.manager.del_sub_meta_rule("admin", self.ref["id"], metarule) self.assertIn(relation, metarule) for item in ("subject_categories", "object_categories", "action_categories"): self.assertEqual( @@ -1310,7 +1310,7 @@ class TestIntraExtensionAdminManagerKO(tests.TestCase): IE["policymodel"] = policy_model IE["name"] = uuid.uuid4().hex - ref = self.admin_manager.load_intra_extension(IE) + ref = self.admin_manager.load_intra_extension_dict(IE) self.assertIsInstance(ref, dict) return ref @@ -2701,11 +2701,11 @@ class TestIntraExtensionAdminManagerKO(tests.TestCase): self.assertRaises( MetaRuleAddNotAuthorized, - self.manager.set_sub_meta_rule_dict, + self.manager.get_sub_meta_rule, demo_user["id"], ref["id"], metarule ) - _sub_meta_rules = self.manager.set_sub_meta_rule_dict(admin_user["id"], ref["id"], metarule) + _sub_meta_rules = self.manager.get_sub_meta_rule(admin_user["id"], ref["id"], metarule) self.assertIn(relation, metarule) for item in ("subject_categories", "object_categories", "action_categories"): self.assertEqual( diff --git a/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_authz.py b/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_authz.py index 707c138d..7bbac97a 100644 --- a/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_authz.py +++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_authz.py @@ -89,7 +89,7 @@ class TestIntraExtensionAuthzManagerAuthz(tests.TestCase): IE["policymodel"] = policy_model IE["name"] = uuid.uuid4().hex - ref = self.admin_manager.load_intra_extension(IE) + ref = self.admin_manager.load_intra_extension_dict(IE) self.assertIsInstance(ref, dict) return ref @@ -123,12 +123,12 @@ class TestIntraExtensionAuthzManagerAuthz(tests.TestCase): tenant = self.create_tenant() self.assertRaises( - IntraExtensionNotFound, + IntraExtensionUnknown, self.manager.get_extension_uuid, tenant["id"], "authz" ) self.assertRaises( - IntraExtensionNotFound, + IntraExtensionUnknown, self.manager.get_extension_uuid, tenant["id"], "admin" ) @@ -142,7 +142,7 @@ class TestIntraExtensionAuthzManagerAuthz(tests.TestCase): def test_authz_exceptions(self): self.assertRaises( - IntraExtensionNotFound, + IntraExtensionUnknown, self.manager.authz, uuid.uuid4().hex, uuid.uuid4().hex, uuid.uuid4().hex, uuid.uuid4().hex ) @@ -322,7 +322,7 @@ class TestIntraExtensionAuthzManagerAuthz(tests.TestCase): "relation": "relation_super" } } - self.manager.set_sub_meta_rule_dict( + self.manager.get_sub_meta_rule( admin_user['id'], self.ref["id"], my_meta_rule @@ -1076,7 +1076,7 @@ class TestIntraExtensionAuthzManagerAuthz(tests.TestCase): metarule[relation]["subject_categories"].append(new_subject_category["id"]) self.assertRaises( MetaRuleAddNotAuthorized, - self.manager.set_sub_meta_rule_dict, + self.manager.get_sub_meta_rule, admin_user["id"], ref["id"], metarule) def test_sub_rules(self): diff --git a/keystone-moon/keystone/tests/moon/unit/test_unit_core_log.py b/keystone-moon/keystone/tests/moon/unit/test_unit_core_log.py index a4ea1d36..f38d68ab 100644 --- a/keystone-moon/keystone/tests/moon/unit/test_unit_core_log.py +++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_log.py @@ -67,7 +67,7 @@ class TestIntraExtensionAdminManager(tests.TestCase): # Create the admin user because IntraExtension needs it self.admin = self.identity_api.create_user(USER_ADMIN) IE["policymodel"] = policy_model - self.ref = self.manager.load_intra_extension(IE) + self.ref = self.manager.load_intra_extension_dict(IE) self.assertIsInstance(self.ref, dict) self.create_tenant(self.ref["id"]) diff --git a/keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py b/keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py index 615b8bbc..bc34feaa 100644 --- a/keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py +++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py @@ -89,7 +89,7 @@ class TestTenantManager(tests.TestCase): data = self.manager.set_tenant_name(_uuid, "new name") self.assertEquals(_uuid, data["id"]) self.assertEquals(data["name"], "new name") - data = self.manager.get_tenant_name(_uuid) + data = self.manager.get_tenant_name_from_id(_uuid) self.assertEquals(data, "new name") def test_delete_tenant(self): @@ -139,7 +139,7 @@ class TestTenantManager(tests.TestCase): self.assertEqual(data, new_mapping[_uuid]["admin"]) def test_unkown_tenant_uuid(self): - self.assertRaises(TenantIDNotFound, self.manager.get_tenant_name, uuid.uuid4().hex) + self.assertRaises(TenantIDNotFound, self.manager.get_tenant_name_from_id, uuid.uuid4().hex) self.assertRaises(TenantIDNotFound, self.manager.set_tenant_name, uuid.uuid4().hex, "new name") self.assertRaises(TenantIDNotFound, self.manager.get_extension_id, uuid.uuid4().hex) _uuid = uuid.uuid4().hex @@ -157,6 +157,6 @@ class TestTenantManager(tests.TestCase): intra_admin_ext_id="" ) self.assertEquals(_uuid, data["id"]) - self.assertRaises(IntraExtensionNotFound, self.manager.get_extension_id, _uuid, "admin") + self.assertRaises(IntraExtensionUnknown, self.manager.get_extension_id, _uuid, "admin") self.assertRaises(TenantIDNotFound, self.manager.get_tenant_uuid, uuid.uuid4().hex) # self.assertRaises(AdminIntraExtensionNotFound, self.manager.get_admin_extension_uuid, uuid.uuid4().hex) |