summaryrefslogtreecommitdiffstats
path: root/snaps/domain
diff options
context:
space:
mode:
authorSteven Pisarski <s.pisarski@cablelabs.com>2017-08-03 14:23:37 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-03 14:23:37 +0000
commit1d3be6637bb78b514a0dfe32a34dbc7c93ea0611 (patch)
tree8866f9d118e108e2f3e613df3bfa7d0b3e586122 /snaps/domain
parent84d902632f1dd77f891c49cfb1d58af5ae051d1a (diff)
parenta4f8adbb935737122b4800efbb19b9d9b75c7e01 (diff)
Merge "Add domain name when creating projects and users"
Diffstat (limited to 'snaps/domain')
-rw-r--r--snaps/domain/project.py17
-rw-r--r--snaps/domain/test/project_tests.py20
2 files changed, 35 insertions, 2 deletions
diff --git a/snaps/domain/project.py b/snaps/domain/project.py
index 73357c7..54407cf 100644
--- a/snaps/domain/project.py
+++ b/snaps/domain/project.py
@@ -32,3 +32,20 @@ class Project:
def __eq__(self, other):
return self.name == other.name and self.id == other.id
+
+
+class Domain:
+ """
+ SNAPS domain object for OpenStack Keystone v3+ domains.
+ """
+ def __init__(self, name, domain_id=None):
+ """
+ Constructor
+ :param name: the project's name
+ :param domain_id: the project's domain id
+ """
+ self.name = name
+ self.id = domain_id
+
+ def __eq__(self, other):
+ return self.name == other.name and self.id == other.id
diff --git a/snaps/domain/test/project_tests.py b/snaps/domain/test/project_tests.py
index 73939f0..3f4fca6 100644
--- a/snaps/domain/test/project_tests.py
+++ b/snaps/domain/test/project_tests.py
@@ -14,12 +14,12 @@
# limitations under the License.
import unittest
-from snaps.domain.project import Project
+from snaps.domain.project import Project, Domain
class ProjectDomainObjectTests(unittest.TestCase):
"""
- Tests the construction of the snaps.domain.test.Project class
+ Tests the construction of the snaps.domain.project.Project class
"""
def test_construction_positional_minimal(self):
@@ -45,3 +45,19 @@ class ProjectDomainObjectTests(unittest.TestCase):
self.assertEqual('foo', project.name)
self.assertEqual('123-456', project.id)
self.assertEqual('hello', project.domain_id)
+
+
+class DomainDomainObjectTests(unittest.TestCase):
+ """
+ Tests the construction of the snaps.domain.project.Domain class
+ """
+
+ def test_construction_positional(self):
+ domain = Domain('foo', '123-456')
+ self.assertEqual('foo', domain.name)
+ self.assertEqual('123-456', domain.id)
+
+ def test_construction_named_minimal(self):
+ domain = Domain(domain_id='123-456', name='foo')
+ self.assertEqual('foo', domain.name)
+ self.assertEqual('123-456', domain.id)