summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommyLike <tommylikehu@gmail.com>2017-06-12 17:46:37 +0800
committerTommyLike <tommylikehu@gmail.com>2017-06-12 20:04:31 +0800
commitc1b03efe0f44bf3c07a9a44ea7db48a2b07ef3bc (patch)
treed6bbf396afcb31615a3c24724fa414706c2edf67
parent44e650a4ed183af9fa977af192355450afd4f1b7 (diff)
downloadpython-cinderclient-c1b03efe0f44bf3c07a9a44ea7db48a2b07ef3bc.tar.gz
Fix PY2/PY3 specific error in testcases
Use 'six.text_type' to wrap defined string value. Change-Id: I229d58595494f59f03538be79de42f2e8007f442 Closes-Bug: #1697401
-rw-r--r--cinderclient/tests/functional/test_snapshot_create_cli.py10
-rw-r--r--cinderclient/tests/functional/test_volume_create_cli.py6
2 files changed, 9 insertions, 7 deletions
diff --git a/cinderclient/tests/functional/test_snapshot_create_cli.py b/cinderclient/tests/functional/test_snapshot_create_cli.py
index ea3d9e6..7ef5dfd 100644
--- a/cinderclient/tests/functional/test_snapshot_create_cli.py
+++ b/cinderclient/tests/functional/test_snapshot_create_cli.py
@@ -10,6 +10,7 @@
# 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 six
from cinderclient.tests.functional import base
@@ -42,10 +43,11 @@ class CinderSnapshotTests(base.ClientTestBase):
2) create snapshot with metadata
3) check that metadata complies entered
"""
- snapshot = self.object_create('snapshot',
- params='--metadata test_metadata=test_date {0}'.
- format(self.volume['id']))
- self.assertEqual("{u'test_metadata': u'test_date'}",
+ snapshot = self.object_create(
+ 'snapshot',
+ params='--metadata test_metadata=test_date {0}'.format(
+ self.volume['id']))
+ self.assertEqual(six.text_type({u'test_metadata': u'test_date'}),
snapshot['metadata'])
self.object_delete('snapshot', snapshot['id'])
self.check_object_deleted('snapshot', snapshot['id'])
diff --git a/cinderclient/tests/functional/test_volume_create_cli.py b/cinderclient/tests/functional/test_volume_create_cli.py
index 2795b78..da4d5fb 100644
--- a/cinderclient/tests/functional/test_volume_create_cli.py
+++ b/cinderclient/tests/functional/test_volume_create_cli.py
@@ -108,7 +108,7 @@ class CinderVolumeTestsWithParameters(base.ClientTestBase):
1) create volume with metadata
2) check that metadata complies entered
"""
- volume = self.object_create('volume',
- params='--metadata test_metadata=test_date 1')
- self.assertEqual("{u'test_metadata': u'test_date'}",
+ volume = self.object_create(
+ 'volume', params='--metadata test_metadata=test_date 1')
+ self.assertEqual(six.text_type({u'test_metadata': u'test_date'}),
volume['metadata'])