Example #1
0
 def test_update_subnet(self):
     """Update subnet: myid --name myname --tags a b."""
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(resource, cmd, 'myid',
                                ['myid', '--name', 'myname',
                                 '--tags', 'a', 'b'],
                                {'name': 'myname', 'tags': ['a', 'b'], }
                                )
 def test_update_subnet_known_option_after_id(self):
     """Update subnet: myid --name myname --request-format json."""
     # --request-format xml is known option
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(
         resource, cmd, 'myid',
         ['myid', '--name', 'myname', '--request-format', 'json'], {
             'name': 'myname',
         })
Example #3
0
 def test_update_subnet_enable_disable_dhcp(self):
     # Update sbunet: --enable-dhcp and --disable-dhcp.
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     self.assertRaises(
         exceptions.CommandError, self._test_update_resource, resource, cmd,
         'myid',
         ['myid', '--name', 'myname', '--enable-dhcp', '--disable-dhcp'], {
             'name': 'myname',
         })
 def test_update_subnet_allocation_pools(self):
     # Update subnet: myid --name myname --tags a b.
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(resource, cmd, 'myid',
                                ['myid', '--allocation-pool',
                                 'start=1.2.0.2,end=1.2.0.127'],
                                {'allocation_pools': [{'start': '1.2.0.2',
                                                       'end': '1.2.0.127'}]}
                                )
Example #5
0
 def test_update_subnet(self):
     # Update subnet: myid --name myname --tags a b.
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(resource, cmd, 'myid', [
         'myid', '--name', 'myname', '--description', 'cavern', '--tags',
         'a', 'b'
     ], {
         'name': 'myname',
         'tags': ['a', 'b'],
         'description': 'cavern'
     })
 def test_update_subnet_enable_disable_dhcp(self):
     """Update sbunet: --enable-dhcp and --disable-dhcp."""
     resource = 'subnet'
     cmd = subnet.UpdateSubnet(test_cli20.MyApp(sys.stdout), None)
     try:
         self._test_update_resource(resource, cmd, 'myid', [
             'myid', '--name', 'myname', '--enable-dhcp', '--disable-dhcp'
         ], {
             'name': 'myname',
         })
     except exceptions.CommandError:
         return
     self.fail('No exception for --enable-dhcp --disable-dhcp option')