summaryrefslogtreecommitdiffstats
path: root/snaps/domain/test
diff options
context:
space:
mode:
authorSteven Pisarski <s.pisarski@cablelabs.com>2017-07-13 19:55:08 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-13 19:55:08 +0000
commitb490e8dc9fb01c6f9c44dd9a585ca1a1ae00bf19 (patch)
treea7545c34d10803375b606f0abcf88d2b2f955268 /snaps/domain/test
parent317a6f8c44efbefaeb800edafcc6fb4cb88bedea (diff)
parent7f989290a14c836b4982e1548d24c9c09f9a0068 (diff)
Merge "Created domain class for routers."
Diffstat (limited to 'snaps/domain/test')
-rw-r--r--snaps/domain/test/network_tests.py55
1 files changed, 52 insertions, 3 deletions
diff --git a/snaps/domain/test/network_tests.py b/snaps/domain/test/network_tests.py
index 13015b2..c394b4a 100644
--- a/snaps/domain/test/network_tests.py
+++ b/snaps/domain/test/network_tests.py
@@ -14,7 +14,8 @@
# limitations under the License.
import unittest
-from snaps.domain.network import Port, SecurityGroup, SecurityGroupRule
+from snaps.domain.network import (
+ Port, SecurityGroup, SecurityGroupRule, Router, InterfaceRouter)
class PortDomainObjectTests(unittest.TestCase):
@@ -38,9 +39,57 @@ class PortDomainObjectTests(unittest.TestCase):
self.assertEqual(ips, port.ips)
+class RouterDomainObjectTests(unittest.TestCase):
+ """
+ Tests the construction of the snaps.domain.network.Router class
+ """
+
+ def test_construction_kwargs(self):
+ sec_grp = Router(
+ **{'name': 'name', 'id': 'id', 'status': 'hello',
+ 'tenant_id': '1234', 'admin_state_up': 'yes',
+ 'external_gateway_info': 'no'})
+ self.assertEqual('name', sec_grp.name)
+ self.assertEqual('id', sec_grp.id)
+ self.assertEqual('hello', sec_grp.status)
+ self.assertEqual('1234', sec_grp.tenant_id)
+ self.assertEqual('yes', sec_grp.admin_state_up)
+ self.assertEqual('no', sec_grp.external_gateway_info)
+
+ def test_construction_named(self):
+ sec_grp = Router(
+ external_gateway_info='no', admin_state_up='yes', tenant_id='1234',
+ status='hello', id='id', name='name')
+ self.assertEqual('name', sec_grp.name)
+ self.assertEqual('id', sec_grp.id)
+ self.assertEqual('hello', sec_grp.status)
+ self.assertEqual('1234', sec_grp.tenant_id)
+ self.assertEqual('yes', sec_grp.admin_state_up)
+ self.assertEqual('no', sec_grp.external_gateway_info)
+
+
+class InterfaceRouterDomainObjectTests(unittest.TestCase):
+ """
+ Tests the construction of the snaps.domain.network.InterfaceRouter class
+ """
+
+ def test_construction_kwargs(self):
+ sec_grp = InterfaceRouter(
+ **{'id': 'id', 'subnet_id': 'foo', 'port_id': 'bar'})
+ self.assertEqual('id', sec_grp.id)
+ self.assertEqual('foo', sec_grp.subnet_id)
+ self.assertEqual('bar', sec_grp.port_id)
+
+ def test_construction_named(self):
+ sec_grp = InterfaceRouter(port_id='bar', subnet_id='foo', id='id')
+ self.assertEqual('id', sec_grp.id)
+ self.assertEqual('foo', sec_grp.subnet_id)
+ self.assertEqual('bar', sec_grp.port_id)
+
+
class SecurityGroupDomainObjectTests(unittest.TestCase):
"""
- Tests the construction of the snaps.domain.test.SecurityGroup class
+ Tests the construction of the snaps.domain.network.SecurityGroup class
"""
def test_construction_proj_id_kwargs(self):
@@ -68,7 +117,7 @@ class SecurityGroupDomainObjectTests(unittest.TestCase):
class SecurityGroupRuleDomainObjectTests(unittest.TestCase):
"""
- Tests the construction of the snaps.domain.test.SecurityGroupRule class
+ Tests the construction of the snaps.domain.network.SecurityGroupRule class
"""
def test_construction_kwargs(self):