Skip to content

Commit aa14677

Browse files
committed
Add marvin test for TrafficTypeResponse
1 parent 99a7961 commit aa14677

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from marvin.cloudstackTestCase import cloudstackTestCase
2+
from marvin.lib.base import (
3+
TrafficType,
4+
PhysicalNetwork,
5+
Zone,
6+
)
7+
from nose.plugins.attrib import attr
8+
9+
10+
class TestTrafficTypeApi(cloudstackTestCase):
11+
@classmethod
12+
def setUpClass(cls):
13+
cls.test_client = super(TestTrafficTypeApi, cls).getClsTestClient()
14+
cls.api_client = cls.testClient.getApiClient()
15+
cls.services = cls.testClient.getParsedTestDataConfig()
16+
cls._cleanup = []
17+
cls.services["advanced_sg"]["zone"]["name"] = "TestTrafficTypeApi-zone"
18+
cls.zone = Zone.create(cls.api_client, cls.services["advanced_sg"]["zone"])
19+
cls._cleanup.append(cls.zone)
20+
21+
cls.physical_network = PhysicalNetwork.create(
22+
cls.api_client,
23+
cls.services["l2-network"],
24+
isolationmethods="VLAN",
25+
zoneid=cls.zone.id,
26+
)
27+
cls._cleanup.append(cls.physical_network)
28+
29+
@attr(tags=["advanced"], required_hardware="false")
30+
def test_list_api_fields(self):
31+
traffic_type = TrafficType.add(
32+
self.api_client,
33+
physicalnetworkid=self.physical_network.id,
34+
kvmnetworklabel="kvm",
35+
traffictype="Public",
36+
vlan="100",
37+
).traffictype
38+
39+
traffic_types = TrafficType.list(
40+
self.api_client,
41+
physicalnetworkid=self.physical_network.id
42+
)
43+
44+
assert len(traffic_types) == 1
45+
response = traffic_types[0]
46+
self.assertEqual(response.id, traffic_type.id)
47+
self.assertEqual(response.kvmnetworklabel, "kvm")
48+
self.assertEqual(response.traffictype, "Public")
49+
self.assertEqual(response.vlan, "100")
50+
self.assertEqual(response.isolationmethods, "VLAN")

0 commit comments

Comments
 (0)