diff options
Diffstat (limited to 'keystone-moon/keystone/tests')
-rw-r--r-- | keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py | 57 | ||||
-rw-r--r-- | keystone-moon/keystone/tests/moon/unit/test_unit_core_tenant.py | 42 |
2 files changed, 79 insertions, 20 deletions
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 new file mode 100644 index 00000000..e6388559 --- /dev/null +++ b/keystone-moon/keystone/tests/moon/unit/test_unit_core_configuration.py @@ -0,0 +1,57 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. + +"""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 + +CONF = cfg.CONF + + +class TestConfigurationManager(tests.TestCase): + + def setUp(self): + self.useFixture(database.Database()) + super(TestConfigurationManager, self).setUp() + self.load_backends() + self.load_fixtures(default_fixtures) + self.manager = ConfigurationManager() + + def load_extra_backends(self): + return { + "moonlog_api": LogManager() + } + + def config_overrides(self): + super(TestConfigurationManager, self).config_overrides() + self.config_fixture.config( + group='moon', + tenant_driver='keystone.contrib.moon.backends.sql.ConfigurationConnector') + + def test_get_policy_template_dict(self): + pass + + def test_get_policy_template_id_from_name(self): + pass + + def test_get_aggregation_algorithm_dict(self): + pass + + def test_get_aggregation_algorithm_id_from_name(self): + pass + + def test_get_sub_meta_rule_algorithm_dict(self): + pass + + def test_get_sub_meta_rule_algorithm_id_from_name(self): + pass + 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 bc34feaa..1da57990 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 @@ -65,11 +65,7 @@ class TestTenantManager(tests.TestCase): data = self.manager.get_admin_extension_uuid(new_mapping[_uuid]["authz"]) self.assertEquals(new_mapping[_uuid]["admin"], data) - def test_tenant_list_empty(self): - data = self.manager.get_tenant_dict() - self.assertEqual(data, {}) - - def test_set_tenant_name(self): + def test_del_tenant(self): _uuid = uuid.uuid4().hex new_mapping = { _uuid: { @@ -86,13 +82,15 @@ class TestTenantManager(tests.TestCase): ) self.assertEquals(_uuid, data["id"]) self.assertEquals(data["name"], new_mapping[_uuid]["name"]) - 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_from_id(_uuid) - self.assertEquals(data, "new name") + self.assertEquals(data["authz"], new_mapping[_uuid]["authz"]) + self.assertEquals(data["admin"], new_mapping[_uuid]["admin"]) + data = self.manager.get_tenant_dict() + self.assertNotEqual(data, {}) + self.manager.delete(new_mapping[_uuid]["authz"]) + data = self.manager.get_tenant_dict() + self.assertEqual(data, {}) - def test_delete_tenant(self): + def test_set_tenant_name(self): _uuid = uuid.uuid4().hex new_mapping = { _uuid: { @@ -109,15 +107,13 @@ class TestTenantManager(tests.TestCase): ) self.assertEquals(_uuid, data["id"]) self.assertEquals(data["name"], new_mapping[_uuid]["name"]) - self.assertEquals(data["authz"], new_mapping[_uuid]["authz"]) - self.assertEquals(data["admin"], new_mapping[_uuid]["admin"]) - data = self.manager.get_tenant_dict() - self.assertNotEqual(data, {}) - self.manager.delete(new_mapping[_uuid]["authz"]) - data = self.manager.get_tenant_dict() - self.assertEqual(data, {}) + 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_from_id(_uuid) + self.assertEquals(data, "new name") - def test_get_extension_uuid(self): + def test_get_tenant_intra_extension_id(self): _uuid = uuid.uuid4().hex new_mapping = { _uuid: { @@ -138,7 +134,7 @@ class TestTenantManager(tests.TestCase): data = self.manager.get_extension_id(_uuid, "admin") self.assertEqual(data, new_mapping[_uuid]["admin"]) - def test_unkown_tenant_uuid(self): + def test_exception_tenantunknown(self): 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) @@ -160,3 +156,9 @@ class TestTenantManager(tests.TestCase): 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) + + def test_exception_tenantaddednameexisting(self): + pass + + def test_exception_tenantnointraextension(self): + pass
\ No newline at end of file |