summaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone/tests
diff options
context:
space:
mode:
Diffstat (limited to 'keystone-moon/keystone/tests')
-rw-r--r--keystone-moon/keystone/tests/moon/unit/__init__.py21
-rw-r--r--keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py19
-rw-r--r--keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_admin.py13
-rw-r--r--keystone-moon/keystone/tests/moon/unit/test_unit_core_intra_extension_authz.py13
-rw-r--r--keystone-moon/keystone/tests/moon/unit/test_unit_core_log.py10
-rw-r--r--keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py9
6 files changed, 23 insertions, 62 deletions
diff --git a/keystone-moon/keystone/tests/moon/unit/__init__.py b/keystone-moon/keystone/tests/moon/unit/__init__.py
index 149585cd..bf3c1d1e 100644
--- a/keystone-moon/keystone/tests/moon/unit/__init__.py
+++ b/keystone-moon/keystone/tests/moon/unit/__init__.py
@@ -24,28 +24,12 @@ def create_intra_extension(self, policy_model="policy_authz"):
if "authz" in policy_model:
genre = "authz"
IE["genre"] = genre
- ref = self.admin_api.load_intra_extension_dict(self.root_api.get_root_admin_id(),
+ ref = self.admin_api.load_intra_extension_dict(self.root_api.root_admin_id,
intra_extension_dict=IE)
self.assertIsInstance(ref, dict)
return ref
-# def create_tenant(self, authz_uuid):
-# tenant = {
-# "id": uuid.uuid4().hex,
-# "name": "TestAuthzIntraExtensionManager",
-# "enabled": True,
-# "description": "",
-# "domain_id": "default"
-# }
-# project = self.resource_api.create_project(tenant["id"], tenant)
-# mapping = self.tenant_api.set_tenant_dict(project["id"], project["name"], authz_uuid, None)
-# self.assertIsInstance(mapping, dict)
-# self.assertIn("authz", mapping)
-# self.assertEqual(mapping["authz"], authz_uuid)
-# return mapping
-
-
def create_user(self, username="TestAdminIntraExtensionManagerUser"):
user = {
"id": uuid.uuid4().hex,
@@ -57,6 +41,7 @@ def create_user(self, username="TestAdminIntraExtensionManagerUser"):
_user = self.identity_api.create_user(user)
return _user
+
def create_mapping(self, tenant_name=None, authz_id=None, admin_id=None):
if not tenant_name:
@@ -72,7 +57,7 @@ def create_mapping(self, tenant_name=None, authz_id=None, admin_id=None):
"domain_id": "default"
}
keystone_tenant = self.resource_api.create_project(tenant["id"], tenant)
- mapping = self.tenant_api.add_tenant_dict(self.root_api.get_root_admin_id(), tenant["id"], tenant)
+ mapping = self.tenant_api.add_tenant_dict(self.root_api.root_admin_id, tenant["id"], tenant)
self.assertIsInstance(mapping, dict)
self.assertIn("intra_authz_extension_id", mapping[tenant["id"]])
self.assertIn("intra_admin_extension_id", mapping[tenant["id"]])
diff --git a/keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py b/keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py
index 8aa8bcd9..8bd6cb4f 100644
--- a/keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py
+++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py
@@ -5,12 +5,9 @@
"""Unit tests for core configuration."""
-import uuid
from oslo_config import cfg
from keystone.tests import unit as tests
-from keystone.contrib.moon.core import ConfigurationManager
from keystone.tests.unit.ksfixtures import database
-from keystone.contrib.moon.exception import *
from keystone.tests.unit import default_fixtures
from keystone.contrib.moon.core import LogManager
from keystone.contrib.moon.core import IntraExtensionAdminManager
@@ -22,7 +19,6 @@ from keystone.tests.moon.unit import *
CONF = cfg.CONF
-# @dependency.requires('admin_api', 'authz_api', 'tenant_api', 'configuration_api', 'moonlog_api')
class TestConfigurationManager(tests.TestCase):
def setUp(self):
@@ -34,9 +30,10 @@ class TestConfigurationManager(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
self.configuration_manager = self.configuration_api
@@ -72,15 +69,3 @@ class TestConfigurationManager(tests.TestCase):
self.assertIsInstance(data, dict)
self.assertIn("policy_root", data)
- # def test_get_aggregation_algorithm_dict(self):
- # admin_intra_extension = create_intra_extension(self, policy_model="policy_rbac_admin")
- # print(admin_intra_extension)
- # data = self.manager.get_aggregation_algorithm_dict(self.ADMIN_ID, admin_intra_extension['id'])
- # print(data)
-
- # def test_get_sub_meta_rule_algorithm_dict(self):
- # data = self.manager.get_sub_meta_rule_algorithm_dict(self.ADMIN_ID)
- # print(data)
- #
- # self.assertEqual("", "ee")
-
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 424e4cbb..d3f088c0 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
@@ -5,15 +5,11 @@
"""Unit tests for core IntraExtensionAdminManager"""
-import json
-import os
-import uuid
from oslo_config import cfg
from keystone.tests import unit as tests
from keystone.contrib.moon.core import IntraExtensionAdminManager, IntraExtensionAuthzManager
-from keystone.contrib.moon.core import IntraExtensionRootManager, ConfigurationManager
+from keystone.contrib.moon.core import ConfigurationManager
from keystone.tests.unit.ksfixtures import database
-from keystone import resource
from keystone.contrib.moon.exception import *
from keystone.tests.unit import default_fixtures
from keystone.contrib.moon.core import LogManager, TenantManager
@@ -47,9 +43,10 @@ class TestIntraExtensionAdminManagerOK(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
@@ -63,7 +60,6 @@ class TestIntraExtensionAdminManagerOK(tests.TestCase):
"admin_api": IntraExtensionAdminManager(),
"authz_api": IntraExtensionAuthzManager(),
"configuration_api": ConfigurationManager(),
- # "resource_api": resource.Manager(),
}
def config_overrides(self):
@@ -969,9 +965,10 @@ class TestIntraExtensionAdminManagerKO(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
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 afe0e7f2..172c6b6d 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
@@ -5,15 +5,11 @@
"""Unit tests for core IntraExtensionAuthzManager"""
-import json
-import os
-import uuid
from oslo_config import cfg
from keystone.tests import unit as tests
from keystone.contrib.moon.core import IntraExtensionAdminManager, IntraExtensionAuthzManager, IntraExtensionRootManager
from keystone.contrib.moon.core import ConfigurationManager
from keystone.tests.unit.ksfixtures import database
-from keystone import resource
from keystone.contrib.moon.exception import *
from keystone.tests.unit import default_fixtures
from keystone.contrib.moon.core import LogManager, TenantManager
@@ -33,7 +29,7 @@ IE = {
"description": "a simple description."
}
-#@dependency.requires('admin_api', 'authz_api', 'tenant_api', 'configuration_api', 'moonlog_api')
+
class TestIntraExtensionAuthzManagerAuthzOK(tests.TestCase):
def setUp(self):
@@ -45,9 +41,10 @@ class TestIntraExtensionAuthzManagerAuthzOK(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
@@ -938,7 +935,6 @@ class TestIntraExtensionAuthzManagerAuthzOK(tests.TestCase):
# TODO: add test for the delete function
-#@dependency.requires('admin_api', 'authz_api', 'tenant_api', 'configuration_api', 'moonlog_api', 'identity_api', 'root_api')
class TestIntraExtensionAuthzManagerAuthzKO(tests.TestCase):
def setUp(self):
@@ -950,9 +946,10 @@ class TestIntraExtensionAuthzManagerAuthzKO(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
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 06864cc5..7d205bc9 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
@@ -5,16 +5,12 @@
"""Unit tests for LogManager"""
-import json
-import os
-import uuid
import time
from oslo_config import cfg
from keystone.tests import unit as tests
from keystone.contrib.moon.core import ConfigurationManager
from keystone.contrib.moon.core import IntraExtensionAuthzManager
from keystone.tests.unit.ksfixtures import database
-from keystone import resource
from keystone.contrib.moon.exception import *
from keystone.tests.unit import default_fixtures
from keystone.contrib.moon.core import LogManager, TenantManager
@@ -36,7 +32,7 @@ IE = {
TIME_FORMAT = '%Y-%m-%d-%H:%M:%S'
-@dependency.requires('admin_api', 'tenant_api', 'configuration_api')
+
class TestIntraExtensionAdminManager(tests.TestCase):
def setUp(self):
@@ -48,9 +44,10 @@ class TestIntraExtensionAdminManager(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
self.tenant_manager = self.tenant_api
@@ -64,7 +61,6 @@ class TestIntraExtensionAdminManager(tests.TestCase):
"authz_api": IntraExtensionAuthzManager(),
"tenant_api": TenantManager(),
"configuration_api": ConfigurationManager(),
- # "resource_api": resource.Manager(),
}
def config_overrides(self):
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 99fb5965..a74bc240 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
@@ -5,7 +5,6 @@
"""Unit tests for core tenant."""
-import uuid
from oslo_config import cfg
from keystone.tests import unit as tests
from keystone.contrib.moon.core import ConfigurationManager
@@ -15,7 +14,7 @@ from keystone.tests.unit import default_fixtures
from keystone.contrib.moon.core import LogManager
from keystone.contrib.moon.core import IntraExtensionRootManager
from keystone.contrib.moon.core import IntraExtensionAdminManager
-from keystone.common import dependency
+from keystone.contrib.moon.core import IntraExtensionAuthzManager
from keystone.tests.moon.unit import *
@@ -31,7 +30,7 @@ IE = {
"description": "a simple description."
}
-@dependency.requires('admin_api', 'tenant_api', 'configuration_api')
+
class TestTenantManager(tests.TestCase):
ADMIN_ID = None
@@ -44,9 +43,10 @@ class TestTenantManager(tests.TestCase):
self.resource_api.create_domain(domain['id'], domain)
self.admin = create_user(self, username="admin")
self.demo = create_user(self, username="demo")
+ self.root_api.load_root_intra_extension_dict()
self.root_intra_extension = self.root_api.get_root_extension_dict()
self.root_intra_extension_id = self.root_intra_extension.keys()[0]
- self.ADMIN_ID = self.root_api.get_root_admin_id()
+ self.ADMIN_ID = self.root_api.root_admin_id
self.authz_manager = self.authz_api
self.admin_manager = self.admin_api
self.tenant_manager = self.tenant_api
@@ -55,6 +55,7 @@ class TestTenantManager(tests.TestCase):
return {
"moonlog_api": LogManager(),
"admin_api": IntraExtensionAdminManager(),
+ "authz_api": IntraExtensionAuthzManager(),
"configuration_api": ConfigurationManager(),
"root_api": IntraExtensionRootManager(),
}