Revision 737995ed

b/kamaki/clients/cyclades/__init__.py
526 526
        r = self.networks_post(json_data=req, success=201)
527 527
        return r.json['network']
528 528

  
529
    def create_port(self, network_id, device_id, security_groups=None):
529
    def create_port(
530
            self, network_id, device_id, security_groups=None, name=None):
530 531
        port = dict(network_id=network_id, device_id=device_id)
531 532
        if security_groups:
532 533
            port['security_groups'] = security_groups
534
        if name:
535
            port['name'] = name
533 536
        r = self.ports_post(json_data=dict(port=port), success=201)
534 537
        return r.json['port']
b/kamaki/clients/cyclades/test.py
282 282
        return_value=FR)
283 283
    def test_create_port(self, ports_post):
284 284
        network_id, device_id, FR.json = 'netid', 'devid', dict(port='ret v')
285
        for security_groups in ([1, 2, 3], None):
285
        for name, sec_grp in product(('port name', None), ([1, 2, 3], None)):
286 286
            self.assertEqual(
287 287
                self.client.create_port(
288
                    network_id, device_id, security_groups=security_groups),
288
                    network_id, device_id,
289
                    name=name, security_groups=sec_grp),
289 290
                'ret v')
290 291
            req = dict(network_id=network_id, device_id=device_id)
291
            if security_groups:
292
                req['security_groups'] = security_groups
292
            if sec_grp:
293
                req['security_groups'] = sec_grp
294
            if name:
295
                req['name'] = name
293 296
            expargs = dict(json_data=dict(port=req), success=201)
294 297
            self.assertEqual(ports_post.mock_calls[-1], call(**expargs))
295 298

  

Also available in: Unified diff