diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-06-05 20:10:56 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-06-05 20:10:56 +0000 |
| commit | c5524c80be4cd3e2443dc9539d1bf21eb3b8e297 (patch) | |
| tree | 50201851c1658f9596bd6e0ccb80184cb413dd7d /openstackclient/tests/functional/volume | |
| parent | adac738f17f4fbf261089f45544a72f63e3ddebe (diff) | |
| parent | 6aceca218af7d1d2c708fde48f1a5f2b798bc421 (diff) | |
| download | python-openstackclient-c5524c80be4cd3e2443dc9539d1bf21eb3b8e297.tar.gz | |
Merge "Replace "Display Name" by "Name" in volume list"
Diffstat (limited to 'openstackclient/tests/functional/volume')
3 files changed, 82 insertions, 8 deletions
diff --git a/openstackclient/tests/functional/volume/v1/test_transfer_request.py b/openstackclient/tests/functional/volume/v1/test_transfer_request.py index 498c9056..bd612829 100644 --- a/openstackclient/tests/functional/volume/v1/test_transfer_request.py +++ b/openstackclient/tests/functional/volume/v1/test_transfer_request.py @@ -27,7 +27,7 @@ class TransferRequestTests(common.BaseVolumeTests): super(TransferRequestTests, cls).setUpClass() cmd_output = json.loads(cls.openstack( 'volume create -f json --size 1 ' + cls.VOLUME_NAME)) - cls.assertOutput(cls.VOLUME_NAME, cmd_output['display_name']) + cls.assertOutput(cls.VOLUME_NAME, cmd_output['name']) cmd_output = json.loads(cls.openstack( 'volume transfer request create -f json ' + @@ -51,7 +51,7 @@ class TransferRequestTests(common.BaseVolumeTests): # create a volume cmd_output = json.loads(self.openstack( 'volume create -f json --size 1 ' + volume_name)) - self.assertEqual(volume_name, cmd_output['display_name']) + self.assertEqual(volume_name, cmd_output['name']) # create volume transfer request for the volume # and get the auth_key of the new transfer request diff --git a/openstackclient/tests/functional/volume/v1/test_volume.py b/openstackclient/tests/functional/volume/v1/test_volume.py index 3f04e071..6eddf213 100644 --- a/openstackclient/tests/functional/volume/v1/test_volume.py +++ b/openstackclient/tests/functional/volume/v1/test_volume.py @@ -81,7 +81,7 @@ class VolumeTests(common.BaseVolumeTests): cmd_output = json.loads(self.openstack( 'volume list -f json ' )) - names = [x["Display Name"] for x in cmd_output] + names = [x["Name"] for x in cmd_output] self.assertIn(name1, names) self.assertIn(name2, names) @@ -97,7 +97,7 @@ class VolumeTests(common.BaseVolumeTests): 'volume list -f json ' + '--name ' + name1 )) - names = [x["Display Name"] for x in cmd_output] + names = [x["Name"] for x in cmd_output] self.assertIn(name1, names) self.assertNotIn(name2, names) @@ -113,7 +113,7 @@ class VolumeTests(common.BaseVolumeTests): )) self.assertEqual( name, - cmd_output["display_name"], + cmd_output["name"], ) self.assertEqual( 1, @@ -155,7 +155,7 @@ class VolumeTests(common.BaseVolumeTests): )) self.assertEqual( new_name, - cmd_output["display_name"], + cmd_output["name"], ) self.assertEqual( 2, @@ -191,6 +191,49 @@ class VolumeTests(common.BaseVolumeTests): cmd_output["properties"], ) + def test_volume_create_and_list_and_show_backward_compatibility(self): + """Test backward compatibility of create, list, show""" + name1 = uuid.uuid4().hex + json_output = json.loads(self.openstack( + 'volume create -f json ' + + '-c display_name -c id ' + + '--size 1 ' + + name1 + )) + self.assertIn('display_name', json_output) + self.assertEqual(name1, json_output['display_name']) + self.assertIn('id', json_output) + volume_id = json_output['id'] + self.assertIsNotNone(volume_id) + self.assertNotIn('name', json_output) + self.addCleanup(self.openstack, 'volume delete ' + volume_id) + + self.wait_for("volume", name1, "available") + + json_output = json.loads(self.openstack( + 'volume list -f json ' + + '-c "Display Name"' + )) + for each_volume in json_output: + self.assertIn('Display Name', each_volume) + + json_output = json.loads(self.openstack( + 'volume list -f json ' + + '-c "Name"' + )) + for each_volume in json_output: + self.assertIn('Name', each_volume) + + json_output = json.loads(self.openstack( + 'volume show -f json ' + + '-c display_name -c id ' + + name1 + )) + self.assertIn('display_name', json_output) + self.assertEqual(name1, json_output['display_name']) + self.assertIn('id', json_output) + self.assertNotIn('name', json_output) + def wait_for(self, check_type, check_name, desired_status, wait=120, interval=5, failures=['ERROR']): status = "notset" diff --git a/openstackclient/tests/functional/volume/v2/test_volume.py b/openstackclient/tests/functional/volume/v2/test_volume.py index 94ac792f..f936907c 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume.py +++ b/openstackclient/tests/functional/volume/v2/test_volume.py @@ -90,7 +90,7 @@ class VolumeTests(common.BaseVolumeTests): 'volume list -f json ' + '--long' )) - names = [x["Display Name"] for x in cmd_output] + names = [x["Name"] for x in cmd_output] self.assertIn(name1, names) self.assertIn(name2, names) @@ -99,7 +99,7 @@ class VolumeTests(common.BaseVolumeTests): 'volume list -f json ' + '--status error' )) - names = [x["Display Name"] for x in cmd_output] + names = [x["Name"] for x in cmd_output] self.assertNotIn(name1, names) self.assertIn(name2, names) @@ -249,6 +249,37 @@ class VolumeTests(common.BaseVolumeTests): 'volume snapshot delete ' + snapshot_name) self.assertOutput('', raw_output) + def test_volume_list_backward_compatibility(self): + """Test backward compatibility of list command""" + name1 = uuid.uuid4().hex + cmd_output = json.loads(self.openstack( + 'volume create -f json ' + + '--size 1 ' + + name1 + )) + self.addCleanup(self.openstack, 'volume delete ' + name1) + self.assertEqual( + 1, + cmd_output["size"], + ) + self.wait_for("volume", name1, "available") + + # Test list -c "Display Name" + cmd_output = json.loads(self.openstack( + 'volume list -f json ' + + '-c "Display Name"' + )) + for each_volume in cmd_output: + self.assertIn('Display Name', each_volume) + + # Test list -c "Name" + cmd_output = json.loads(self.openstack( + 'volume list -f json ' + + '-c "Name"' + )) + for each_volume in cmd_output: + self.assertIn('Name', each_volume) + def wait_for(self, check_type, check_name, desired_status, wait=120, interval=5, failures=['ERROR']): status = "notset" |
