diff options
Diffstat (limited to 'barbicanclient/tests/v1/test_secrets.py')
-rw-r--r-- | barbicanclient/tests/v1/test_secrets.py | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/barbicanclient/tests/v1/test_secrets.py b/barbicanclient/tests/v1/test_secrets.py index dcc2fdf..bf5624e 100644 --- a/barbicanclient/tests/v1/test_secrets.py +++ b/barbicanclient/tests/v1/test_secrets.py @@ -27,14 +27,14 @@ from barbicanclient.v1 import secrets class SecretData(object): def __init__(self): - self.name = u'Self destruction sequence' - self.payload = u'the magic words are squeamish ossifrage' - self.payload_content_type = u'text/plain' - self.algorithm = u'AES' + self.name = 'Self destruction sequence' + self.payload = 'the magic words are squeamish ossifrage' + self.payload_content_type = 'text/plain' + self.algorithm = 'AES' self.created = str(timeutils.utcnow()) self.secret_dict = {'name': self.name, - 'status': u'ACTIVE', + 'status': 'ACTIVE', 'algorithm': self.algorithm, 'created': self.created} @@ -93,7 +93,7 @@ class WhenTestingSecrets(test_client.BaseEntityResource): self.assertEqual(self.secret.payload, secret_req['payload']) def test_should_store_binary_type_as_octet_stream(self): - """We use six.binary_type as the canonical binary type. + """We use bytes as the canonical binary type. The client should base64 encode the payload before sending the request. @@ -101,8 +101,6 @@ class WhenTestingSecrets(test_client.BaseEntityResource): data = {'secret_ref': self.entity_href} self.responses.post(self.entity_base + '/', json=data) - # This literal will have type(str) in Python 2, but will have - # type(bytes) in Python 3. It is six.binary_type in both cases. binary_payload = b'F\x130\x89f\x8e\xd9\xa1\x0e\x1f\r\xf67uu\x8b' secret = self.manager.create() @@ -112,20 +110,18 @@ class WhenTestingSecrets(test_client.BaseEntityResource): secret_req = jsonutils.loads(self.responses.last_request.text) self.assertEqual(self.secret.name, secret_req['name']) - self.assertEqual(u'application/octet-stream', + self.assertEqual('application/octet-stream', secret_req['payload_content_type']) - self.assertEqual(u'base64', + self.assertEqual('base64', secret_req['payload_content_encoding']) self.assertNotEqual(binary_payload, secret_req['payload']) def test_should_store_text_type_as_text_plain(self): - """We use six.text_type as the canonical text type.""" + """We use unicode string as the canonical text type.""" data = {'secret_ref': self.entity_href} self.responses.post(self.entity_base + '/', json=data) - # This literal will have type(unicode) in Python 2, but will have - # type(str) in Python 3. It is six.text_type in both cases. - text_payload = u'time for an ice cold \U0001f37a' + text_payload = 'time for an ice cold \U0001f37a' secret = self.manager.create() secret.payload = text_payload @@ -133,7 +129,7 @@ class WhenTestingSecrets(test_client.BaseEntityResource): secret_req = jsonutils.loads(self.responses.last_request.text) self.assertEqual(text_payload, secret_req['payload']) - self.assertEqual(u'text/plain', secret_req['payload_content_type']) + self.assertEqual('text/plain', secret_req['payload_content_type']) def test_should_store_with_deprecated_content_type(self): """DEPRECATION WARNING @@ -145,7 +141,7 @@ class WhenTestingSecrets(test_client.BaseEntityResource): self.responses.post(self.entity_base + '/', json=data) payload = 'I should be octet-stream' - payload_content_type = u'text/plain' + payload_content_type = 'text/plain' secret = self.manager.create() secret.payload = payload @@ -169,8 +165,8 @@ class WhenTestingSecrets(test_client.BaseEntityResource): encoded_payload = base64.b64encode( b'F\x130\x89f\x8e\xd9\xa1\x0e\x1f\r\xf67uu\x8b' ).decode('UTF-8') - payload_content_type = u'application/octet-stream' - payload_content_encoding = u'base64' + payload_content_type = 'application/octet-stream' + payload_content_encoding = 'base64' secret = self.manager.create() secret.payload = encoded_payload @@ -448,9 +444,7 @@ class WhenTestingSecrets(test_client.BaseEntityResource): self.test_should_delete_from_object(self.entity_id) def test_should_update_from_manager(self, secret_ref=None): - # This literal will have type(unicode) in Python 2, but will have - # type(str) in Python 3. It is six.text_type in both cases. - text_payload = u'time for an ice cold \U0001f37a' + text_payload = 'time for an ice cold \U0001f37a' secret_ref = secret_ref or self.entity_href self.responses.put(self.entity_href, status_code=204) @@ -479,9 +473,7 @@ class WhenTestingSecrets(test_client.BaseEntityResource): # Verify the secret has the correct ref for testing updates self.assertEqual(secref_ref, secret.secret_ref) - # This literal will have type(unicode) in Python 2, but will have - # type(str) in Python 3. It is six.text_type in both cases. - text_payload = u'time for an ice cold \U0001f37a' + text_payload = 'time for an ice cold \U0001f37a' self.responses.put(self.entity_href, status_code=204) |