Revision ccdd1b82 kamaki/clients/cyclades/test.py
b/kamaki/clients/cyclades/test.py | ||
---|---|---|
277 | 277 |
expargs = dict(json_data=dict(network=req), success=201) |
278 | 278 |
self.assertEqual(networks_post.mock_calls[-1], call(**expargs)) |
279 | 279 |
|
280 |
@patch( |
|
281 |
'kamaki.clients.network.rest_api.NetworkRestClient.ports_post', |
|
282 |
return_value=FR) |
|
283 |
def test_create_port(self, ports_post): |
|
284 |
network_id, device_id, FR.json = 'netid', 'devid', dict(port='ret v') |
|
285 |
for security_groups in ([1, 2, 3], None): |
|
286 |
self.assertEqual( |
|
287 |
self.client.create_port( |
|
288 |
network_id, device_id, security_groups=security_groups), |
|
289 |
'ret v') |
|
290 |
req = dict(network_id=network_id, device_id=device_id) |
|
291 |
if security_groups: |
|
292 |
req['security_groups'] = security_groups |
|
293 |
expargs = dict(json_data=dict(port=req), success=201) |
|
294 |
self.assertEqual(ports_post.mock_calls[-1], call(**expargs)) |
|
295 |
|
|
280 | 296 |
|
281 | 297 |
class CycladesClient(TestCase): |
282 | 298 |
|
Also available in: Unified diff