MCPcopy Create free account
hub / github.com/apache/cloudstack / setUpClass

Method setUpClass

test/integration/component/test_eip_elb.py:102–180  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

100
101 @classmethod
102 def setUpClass(cls):
103 cls.testClient = super(TestEIP, cls).getClsTestClient()
104 cls.api_client = cls.testClient.getApiClient()
105
106 cls.services = Services().services
107
108 try:
109 cls.services["netscaler"] = cls.config.__dict__[
110 "netscalerDevice"].__dict__
111 except KeyError:
112 raise unittest.SkipTest("Please make sure you have included netscalerDevice\
113 dict in your config file (keys - ipaddress, username,\
114 password")
115 except Exception as e:
116 raise unittest.SkipTest(e)
117
118 # Get Zone, Domain and templates
119 cls.domain = get_domain(cls.api_client)
120 cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
121 cls.services['mode'] = cls.zone.networktype
122 cls.template = get_template(
123 cls.api_client,
124 cls.zone.id,
125 cls.services["ostype"]
126 )
127 cls.services["virtual_machine"]["zoneid"] = cls.zone.id
128 cls.services["virtual_machine"]["template"] = cls.template.id
129
130 cls.service_offering = ServiceOffering.create(
131 cls.api_client,
132 cls.services["service_offering"]
133 )
134 cls.account = Account.create(
135 cls.api_client,
136 cls.services["account"],
137 admin=True,
138 domainid=cls.domain.id
139 )
140 # Spawn an instance
141 cls.virtual_machine = VirtualMachine.create(
142 cls.api_client,
143 cls.services["virtual_machine"],
144 accountid=cls.account.name,
145 domainid=cls.account.domainid,
146 serviceofferingid=cls.service_offering.id
147 )
148 networks = Network.list(
149 cls.api_client,
150 zoneid=cls.zone.id,
151 listall=True
152 )
153 if isinstance(networks, list):
154 # Basic zone has only one network i.e Basic network
155 cls.guest_network = networks[0]
156 else:
157 raise Exception(
158 "List networks returned empty response for zone: %s" %
159 cls.zone.id)

Callers

nothing calls this directly

Calls 9

get_domainFunction · 0.90
get_zoneFunction · 0.90
get_templateFunction · 0.90
getClsTestClientMethod · 0.80
getApiClientMethod · 0.80
getZoneForTestsMethod · 0.80
ServicesClass · 0.70
createMethod · 0.65
listMethod · 0.65

Tested by

no test coverage detected