summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorjiahui.qiang <jiahui.qiang@easystack.cn>2017-01-19 04:35:29 +0800
committerDean Troyer <dtroyer@gmail.com>2017-02-23 15:51:48 +0000
commit7d93db21e59e8518ed2ca8018cecb69dc3f5b2e4 (patch)
tree5999421cca627a1e2a5f114464ba937009508834 /openstackclient/tests
parent3b562ffa904ebb23396c2d6c7398a520cd535238 (diff)
downloadpython-openstackclient-7d93db21e59e8518ed2ca8018cecb69dc3f5b2e4.tar.gz
Fix can not set is_default in network
The value of is_default always be None, can not be set by "network set" command. Allow "--default" and "--no-default" options to be recognized when ``--external`` is not present. Closes-bug:#1665231 Change-Id: I7a05fc7734a15994f72ca4e47997b4952f1f72f8
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/functional/network/v2/test_network.py68
1 files changed, 15 insertions, 53 deletions
diff --git a/openstackclient/tests/functional/network/v2/test_network.py b/openstackclient/tests/functional/network/v2/test_network.py
index 1f7b7c9e..12636558 100644
--- a/openstackclient/tests/functional/network/v2/test_network.py
+++ b/openstackclient/tests/functional/network/v2/test_network.py
@@ -126,6 +126,7 @@ class NetworkTests(base.TestCase):
cmd_output = json.loads(self.openstack(
'network create -f json ' +
'--description aaaa ' +
+ '--no-default ' +
name1
))
self.addCleanup(self.openstack, 'network delete ' + name1)
@@ -147,17 +148,11 @@ class NetworkTests(base.TestCase):
'Internal',
cmd_output["router:external"],
)
- # NOTE(dtroyer): is_default is not present in the create output
- # so make sure it stays that way.
- # NOTE(stevemar): is_default *is* present in SDK 0.9.11 and newer,
- # but the value seems to always be None, regardless
- # of the --default or --no-default value.
- # self.assertEqual('x', cmd_output)
- if ('is_default' in cmd_output):
- self.assertEqual(
- None,
- cmd_output["is_default"],
- )
+
+ self.assertEqual(
+ False,
+ cmd_output["is_default"],
+ )
self.assertEqual(
True,
cmd_output["port_security_enabled"],
@@ -185,11 +180,10 @@ class NetworkTests(base.TestCase):
True,
cmd_output["shared"],
)
- if ('is_default' in cmd_output):
- self.assertEqual(
- None,
- cmd_output["is_default"],
- )
+ self.assertEqual(
+ None,
+ cmd_output["is_default"],
+ )
self.assertEqual(
True,
cmd_output["port_security_enabled"],
@@ -275,16 +269,11 @@ class NetworkTests(base.TestCase):
'Internal',
cmd_output["router:external"],
)
- # NOTE(dtroyer): is_default is not present in the create output
- # so make sure it stays that way.
- # NOTE(stevemar): is_default *is* present in SDK 0.9.11 and newer,
- # but the value seems to always be None, regardless
- # of the --default or --no-default value.
- if ('is_default' in cmd_output):
- self.assertEqual(
- None,
- cmd_output["is_default"],
- )
+
+ self.assertEqual(
+ False,
+ cmd_output["is_default"],
+ )
self.assertEqual(
True,
cmd_output["port_security_enabled"],
@@ -321,7 +310,6 @@ class NetworkTests(base.TestCase):
'External',
cmd_output["router:external"],
)
- # why not 'None' like above??
self.assertEqual(
False,
cmd_output["is_default"],
@@ -330,29 +318,3 @@ class NetworkTests(base.TestCase):
False,
cmd_output["port_security_enabled"],
)
-
- # NOTE(dtroyer): There is ambiguity around is_default in that
- # it is not in the API docs and apparently can
- # not be set when the network is --external,
- # although the option handling code only looks at
- # the value of is_default when external is True.
- raw_output = self.openstack(
- 'network set ' +
- '--default ' +
- name
- )
- self.assertOutput('', raw_output)
-
- cmd_output = json.loads(self.openstack(
- 'network show -f json ' + name
- ))
-
- self.assertEqual(
- 'cccc',
- cmd_output["description"],
- )
- # NOTE(dtroyer): This should be 'True'
- self.assertEqual(
- False,
- cmd_output["port_security_enabled"],
- )