python-openstackclient/openstackclient/tests/functional/volume/v2/test_qos.py
jiahui.qiang f353253122 Error in the return of command 'volume qos create'
This patch fixed a 'volume qos create' display mistake in argument
of 'specs'[1]. For command such as:

 $ openstack volume qos create hello

 [1]https://bugs.launchpad.net/python-openstackclient/+bug/1656767
Closes-bug:#1656767

Change-Id: Ia9fce833d318d9b52b97c12cfb89e2d3c5465fbe
2017-01-17 15:19:22 +08:00

63 lines
2.3 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import uuid
from openstackclient.tests.functional.volume.v2 import common
class QosTests(common.BaseVolumeTests):
"""Functional tests for volume qos. """
NAME = uuid.uuid4().hex
HEADERS = ['Name']
FIELDS = ['id', 'name']
ID = None
@classmethod
def setUpClass(cls):
super(QosTests, cls).setUpClass()
opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack('volume qos create ' + cls.NAME + opts)
cls.ID, name, rol = raw_output.split('\n')
cls.assertOutput(cls.NAME, name)
@classmethod
def tearDownClass(cls):
raw_output = cls.openstack('volume qos delete ' + cls.ID)
cls.assertOutput('', raw_output)
def test_volume_qos_list(self):
opts = self.get_opts(self.HEADERS)
raw_output = self.openstack('volume qos list' + opts)
self.assertIn(self.NAME, raw_output)
def test_volume_qos_show(self):
opts = self.get_opts(self.FIELDS)
raw_output = self.openstack('volume qos show ' + self.ID + opts)
self.assertEqual(self.ID + "\n" + self.NAME + "\n", raw_output)
def test_volume_qos_metadata(self):
raw_output = self.openstack(
'volume qos set --property a=b --property c=d ' + self.ID)
self.assertEqual("", raw_output)
opts = self.get_opts(['name', 'properties'])
raw_output = self.openstack('volume qos show ' + self.ID + opts)
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
raw_output = self.openstack(
'volume qos unset --property a ' + self.ID)
self.assertEqual("", raw_output)
opts = self.get_opts(['name', 'properties'])
raw_output = self.openstack('volume qos show ' + self.ID + opts)
self.assertEqual(self.NAME + "\nc='d'\n", raw_output)