aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2017-08-11 09:31:25 +0300
committerJuha Kosonen <juha.kosonen@nokia.com>2017-08-15 13:54:18 +0300
commit3ed570c27587e69f384a6e9ab2711d553b7dcde6 (patch)
tree3fd9205e23c1398116caad39c49a12d48f78cee7 /functest/tests
parent42877bb48714293d3ec761f42007fcc8fa925724 (diff)
Fix domain in tenant creation
Use the ID of the domain when creating a tenant on keystone v3. Change-Id: Ic415237e2bb2d537f07ab2245816a575f977aaa0 Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index cabd18e5..3bd7e3dd 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -13,6 +13,7 @@ import unittest
import mock
from functest.utils import openstack_utils
+from functest.utils.constants import CONST
class OSUtilsTesting(unittest.TestCase):
@@ -187,11 +188,18 @@ class OSUtilsTesting(unittest.TestCase):
mock_obj.configure_mock(**attrs)
self.role = mock_obj
+ mock_obj = mock.Mock()
+ attrs = {'id': 'domain_id',
+ 'name': 'test_domain'}
+ mock_obj.configure_mock(**attrs)
+ self.domain = mock_obj
+
self.keystone_client = mock.Mock()
attrs = {'projects.list.return_value': [self.tenant],
'tenants.list.return_value': [self.tenant],
'users.list.return_value': [self.user],
'roles.list.return_value': [self.role],
+ 'domains.list.return_value': [self.domain],
'projects.create.return_value': self.tenant,
'tenants.create.return_value': self.tenant,
'users.create.return_value': self.user,
@@ -1650,9 +1658,16 @@ class OSUtilsTesting(unittest.TestCase):
'test_role'),
'role_id')
+ def test_get_domain_id_default(self):
+ self.assertEqual(openstack_utils.
+ get_domain_id(self.keystone_client,
+ 'test_domain'),
+ 'domain_id')
+
def test_create_tenant_default(self):
with mock.patch('functest.utils.openstack_utils.'
'is_keystone_v3', return_value=True):
+ CONST.__setattr__('OS_PROJECT_DOMAIN_NAME', 'Default')
self.assertEqual(openstack_utils.
create_tenant(self.keystone_client,
'test_tenant',