summaryrefslogtreecommitdiff
path: root/openstackclient/tests/network
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2015-12-15 11:40:23 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-02 13:58:43 +0800
commita83c1f0a4244d6c422a68cf5bf2bbaa3e4617b78 (patch)
treef498e3510ab17be8717900e6afc6c66342ce05b4 /openstackclient/tests/network
parentceb17e11a9ca0a2dc6c6d72466ad2c7b31a29878 (diff)
downloadpython-openstackclient-a83c1f0a4244d6c422a68cf5bf2bbaa3e4617b78.tar.gz
Network: Abstract get_body() out to be a private helper.
get_body() is needed in each network files to construct a dict to pass to sdk proxy. And it is also used by several functions in each file. So define it as a file level private helper function. The unified prototype should be: def _get_attrs(client_manager, parsed_args): 1. The name, in sdk, the parameter passed to proxy is named "attrs". And it is a private method. So let's call it _get_attrs(). 2. The parameters, besides parsed_args, when we deal with project and project_domain, we have to make use of identity_client. So let's pass in the client manager. Change-Id: Ib044ebd4ddedbcd805f46334a7fe99e4ebb5b249
Diffstat (limited to 'openstackclient/tests/network')
-rw-r--r--openstackclient/tests/network/v2/fakes.py1
-rw-r--r--openstackclient/tests/network/v2/test_network.py19
2 files changed, 11 insertions, 9 deletions
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py
index 4c862bd3..9d1dc544 100644
--- a/openstackclient/tests/network/v2/fakes.py
+++ b/openstackclient/tests/network/v2/fakes.py
@@ -96,7 +96,6 @@ class FakeNetwork(object):
'subnets': ['a', 'b'],
'provider_network_type': 'vlan',
'router_external': True,
- 'is_dirty': True,
'availability_zones': [],
'availability_zone_hints': [],
}
diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py
index 37cc6674..f96497a4 100644
--- a/openstackclient/tests/network/v2/test_network.py
+++ b/openstackclient/tests/network/v2/test_network.py
@@ -440,8 +440,6 @@ class TestSetNetwork(TestNetwork):
self.cmd = network.SetNetwork(self.app, self.namespace)
def test_set_this(self):
- self._network.is_dirty = True
-
arglist = [
self._network.name,
'--enable',
@@ -458,12 +456,15 @@ class TestSetNetwork(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
- self.network.update_network.assert_called_with(self._network)
+ attrs = {
+ 'name': 'noob',
+ 'admin_state_up': True,
+ 'shared': True,
+ }
+ self.network.update_network.assert_called_with(self._network, **attrs)
self.assertIsNone(result)
def test_set_that(self):
- self._network.is_dirty = True
-
arglist = [
self._network.name,
'--disable',
@@ -478,12 +479,14 @@ class TestSetNetwork(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
- self.network.update_network.assert_called_with(self._network)
+ attrs = {
+ 'admin_state_up': False,
+ 'shared': False,
+ }
+ self.network.update_network.assert_called_with(self._network, **attrs)
self.assertIsNone(result)
def test_set_nothing(self):
- self._network.is_dirty = False
-
arglist = [self._network.name, ]
verifylist = [('identifier', self._network.name), ]