summaryrefslogtreecommitdiff
path: root/functional/tests/compute
diff options
context:
space:
mode:
authorKyrylo Romanenko <kromanenko@mirantis.com>2016-07-05 12:16:18 +0300
committerSteve Martinelli <s.martinelli@gmail.com>2016-07-05 15:39:03 +0000
commit259b4a14628b5eae5f9154a052381145e7e7ba1e (patch)
treef3449aa2857717436e1b4128a6e713a60f566783 /functional/tests/compute
parent44d4188149faa53d377adf6af6a64a1f6403ce43 (diff)
downloadpython-openstackclient-259b4a14628b5eae5f9154a052381145e7e7ba1e.tar.gz
Deduplicate get_opts methods
One get_opts method can work instead of get_list_opts and get_show_opts both. Remove mutable default value. Change-Id: I9c5683d416f0f3ed4989abab6f152b0341e30a4f
Diffstat (limited to 'functional/tests/compute')
-rw-r--r--functional/tests/compute/v2/test_agent.py2
-rw-r--r--functional/tests/compute/v2/test_aggregate.py8
-rw-r--r--functional/tests/compute/v2/test_flavor.py8
-rw-r--r--functional/tests/compute/v2/test_server.py18
-rw-r--r--functional/tests/compute/v2/test_server_group.py6
5 files changed, 21 insertions, 21 deletions
diff --git a/functional/tests/compute/v2/test_agent.py b/functional/tests/compute/v2/test_agent.py
index 2d7ea216..ad2e8253 100644
--- a/functional/tests/compute/v2/test_agent.py
+++ b/functional/tests/compute/v2/test_agent.py
@@ -31,7 +31,7 @@ class ComputeAgentTests(test.TestCase):
@classmethod
def setUpClass(cls):
- opts = cls.get_show_opts(cls.HEADERS)
+ opts = cls.get_opts(cls.HEADERS)
raw_output = cls.openstack('compute agent create ' +
cls.OS + ' ' + cls.ARCH + ' ' +
cls.VER + ' ' + cls.URL + ' ' +
diff --git a/functional/tests/compute/v2/test_aggregate.py b/functional/tests/compute/v2/test_aggregate.py
index 5bac5858..adb14e52 100644
--- a/functional/tests/compute/v2/test_aggregate.py
+++ b/functional/tests/compute/v2/test_aggregate.py
@@ -24,7 +24,7 @@ class AggregateTests(test.TestCase):
@classmethod
def setUpClass(cls):
- opts = cls.get_show_opts(cls.FIELDS)
+ opts = cls.get_opts(cls.FIELDS)
# Use the default 'nova' availability zone for the aggregate.
raw_output = cls.openstack(
'aggregate create --zone nova ' + cls.NAME + opts
@@ -38,17 +38,17 @@ class AggregateTests(test.TestCase):
cls.assertOutput('', raw_output)
def test_aggregate_list(self):
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('aggregate list' + opts)
self.assertIn(self.NAME, raw_output)
def test_aggregate_show(self):
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('aggregate show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)
def test_aggregate_properties(self):
- opts = self.get_show_opts(['properties'])
+ opts = self.get_opts(['properties'])
raw_output = self.openstack(
'aggregate set --property a=b --property c=d ' + self.NAME
diff --git a/functional/tests/compute/v2/test_flavor.py b/functional/tests/compute/v2/test_flavor.py
index 6edb1fdf..ef0d2fe3 100644
--- a/functional/tests/compute/v2/test_flavor.py
+++ b/functional/tests/compute/v2/test_flavor.py
@@ -24,7 +24,7 @@ class FlavorTests(test.TestCase):
@classmethod
def setUpClass(cls):
- opts = cls.get_show_opts(cls.FIELDS)
+ opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack(
'flavor create --property a=b --property c=d ' + cls.NAME + opts)
expected = cls.NAME + '\n'
@@ -36,18 +36,18 @@ class FlavorTests(test.TestCase):
cls.assertOutput('', raw_output)
def test_flavor_list(self):
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('flavor list' + opts)
self.assertIn("small", raw_output)
self.assertIn(self.NAME, raw_output)
def test_flavor_show(self):
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('flavor show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)
def test_flavor_properties(self):
- opts = self.get_show_opts(['properties'])
+ opts = self.get_opts(['properties'])
# check the properties we added in create command.
raw_output = self.openstack('flavor show ' + self.NAME + opts)
self.assertEqual("a='b', c='d'\n", raw_output)
diff --git a/functional/tests/compute/v2/test_server.py b/functional/tests/compute/v2/test_server.py
index d08b003f..511ac372 100644
--- a/functional/tests/compute/v2/test_server.py
+++ b/functional/tests/compute/v2/test_server.py
@@ -58,7 +58,7 @@ class ServerTests(test.TestCase):
def server_create(self, name=None):
"""Create server. Add cleanup."""
name = name or data_utils.rand_uuid()
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
flavor = self.get_flavor()
image = self.get_image()
network = self.get_network()
@@ -72,7 +72,7 @@ class ServerTests(test.TestCase):
def server_list(self, params=[]):
"""List servers."""
- opts = self.get_list_opts(params)
+ opts = self.get_opts(params)
return self.openstack('server list' + opts)
def server_delete(self, name):
@@ -114,7 +114,7 @@ class ServerTests(test.TestCase):
2) List servers
3) Check output
"""
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('server list' + opts)
self.assertIn(self.NAME, raw_output)
@@ -126,7 +126,7 @@ class ServerTests(test.TestCase):
2) Show server
3) Check output
"""
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('server show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)
@@ -144,13 +144,13 @@ class ServerTests(test.TestCase):
# metadata
raw_output = self.openstack(
'server set --property a=b --property c=d ' + self.NAME)
- opts = self.get_show_opts(["name", "properties"])
+ opts = self.get_opts(["name", "properties"])
raw_output = self.openstack('server show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
raw_output = self.openstack(
'server unset --property a ' + self.NAME)
- opts = self.get_show_opts(["name", "properties"])
+ opts = self.get_opts(["name", "properties"])
raw_output = self.openstack('server show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\nc='d'\n", raw_output)
@@ -224,7 +224,7 @@ class ServerTests(test.TestCase):
"""
self.wait_for_status("ACTIVE")
# rescue
- opts = self.get_show_opts(["adminPass"])
+ opts = self.get_opts(["adminPass"])
raw_output = self.openstack('server rescue ' + self.NAME + opts)
self.assertNotEqual("", raw_output)
self.wait_for_status("RESCUE")
@@ -248,7 +248,7 @@ class ServerTests(test.TestCase):
"""
self.wait_for_status("ACTIVE")
# attach ip
- opts = self.get_show_opts(["id", "floating_ip_address"])
+ opts = self.get_opts(["id", "floating_ip_address"])
raw_output = self.openstack('ip floating create ' +
self.IP_POOL +
opts)
@@ -288,7 +288,7 @@ class ServerTests(test.TestCase):
# TODO(thowe): Add a server wait command to osc
failures = ['ERROR']
total_sleep = 0
- opts = self.get_show_opts(['status'])
+ opts = self.get_opts(['status'])
while total_sleep < wait:
status = self.openstack('server show ' + self.NAME + opts)
status = status.rstrip()
diff --git a/functional/tests/compute/v2/test_server_group.py b/functional/tests/compute/v2/test_server_group.py
index c073b88e..b9126052 100644
--- a/functional/tests/compute/v2/test_server_group.py
+++ b/functional/tests/compute/v2/test_server_group.py
@@ -24,7 +24,7 @@ class ServerGroupTests(test.TestCase):
@classmethod
def setUpClass(cls):
- opts = cls.get_show_opts(cls.FIELDS)
+ opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack('server group create --policy affinity ' +
cls.NAME + opts)
expected = cls.NAME + '\n'
@@ -36,11 +36,11 @@ class ServerGroupTests(test.TestCase):
cls.assertOutput('', raw_output)
def test_server_group_list(self):
- opts = self.get_list_opts(self.HEADERS)
+ opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('server group list' + opts)
self.assertIn(self.NAME, raw_output)
def test_server_group_show(self):
- opts = self.get_show_opts(self.FIELDS)
+ opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('server group show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n", raw_output)