diff options
| author | Reedip <reedip.banerjee@nectechnologies.in> | 2016-09-10 16:59:19 +0530 |
|---|---|---|
| committer | Reedip <reedip.banerjee@nectechnologies.in> | 2016-09-21 04:24:47 +0000 |
| commit | 7f12b745ce509218f1ea38bb313d433688bcbf6f (patch) | |
| tree | 58b3d233b6f208231f9a66d0cad4b7e6f37f53d8 /openstackclient/tests | |
| parent | 43f6b95229cf1bd38a167401faab2b9f0319422d (diff) | |
| download | python-openstackclient-7f12b745ce509218f1ea38bb313d433688bcbf6f.tar.gz | |
Overwrite/Clear support for subnets
This patch adds the overwrite/clear functionality
for allocation-pool and host-routes in subnets.
Change-Id: Idfa41173d0c054c5bfb4eda8c5f614928012555a
implements: blueprint allow-overwrite-set-options
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/unit/network/v2/test_subnet.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py index 58506391..9c468f39 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet.py +++ b/openstackclient/tests/unit/network/v2/test_subnet.py @@ -938,6 +938,39 @@ class TestSetSubnet(TestSubnet): self.network.update_subnet.assert_called_with(self._subnet, **attrs) self.assertIsNone(result) + def test_overwrite_options(self): + _testsubnet = network_fakes.FakeSubnet.create_one_subnet( + {'host_routes': [{'destination': '10.20.20.0/24', + 'nexthop': '10.20.20.1'}], + 'allocation_pools': [{'start': '8.8.8.200', + 'end': '8.8.8.250'}], }) + self.network.find_subnet = mock.Mock(return_value=_testsubnet) + arglist = [ + '--host-route', 'destination=10.30.30.30/24,gateway=10.30.30.1', + '--no-host-route', + '--allocation-pool', 'start=8.8.8.100,end=8.8.8.150', + '--no-allocation-pool', + _testsubnet.name, + ] + verifylist = [ + ('host_routes', [{ + "destination": "10.30.30.30/24", "gateway": "10.30.30.1"}]), + ('allocation_pools', [{ + 'start': '8.8.8.100', 'end': '8.8.8.150'}]), + ('no_host_route', True), + ('no_allocation_pool', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + attrs = { + 'host_routes': [{ + "destination": "10.30.30.30/24", "nexthop": "10.30.30.1"}], + 'allocation_pools': [{'start': '8.8.8.100', 'end': '8.8.8.150'}], + } + self.network.update_subnet.assert_called_once_with( + _testsubnet, **attrs) + self.assertIsNone(result) + class TestShowSubnet(TestSubnet): # The subnets to be shown |
