diff options
author | Vu Cong Tuan <tuanvc@vn.fujitsu.com> | 2018-11-02 16:26:49 +0700 |
---|---|---|
committer | Vu Cong Tuan <tuanvc@vn.fujitsu.com> | 2018-11-02 16:27:47 +0700 |
commit | 02d0090c4762703383cde00cd80ea6dadad565e5 (patch) | |
tree | 0fcb32bd14810b2a5d5f0978a67b700d25d49690 /heatclient | |
parent | ada4b90083ee2d6e61133d759be90daf325358e6 (diff) | |
download | python-heatclient-02d0090c4762703383cde00cd80ea6dadad565e5.tar.gz |
Replace deprecated "decodestring()" by "decodebytes()"
decodestring() is deprecated alias of decodebytes()
https://docs.python.org/3/library/base64.html#base64.decodestring
The same has been done for nova:
https://review.openstack.org/#/c/610401/
Change-Id: Ie069aaaff1646a70f3717fc6f9c7252949c4e5fd
Diffstat (limited to 'heatclient')
-rw-r--r-- | heatclient/tests/unit/test_template_utils.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/heatclient/tests/unit/test_template_utils.py b/heatclient/tests/unit/test_template_utils.py index e4303c6..3d0d478 100644 --- a/heatclient/tests/unit/test_template_utils.py +++ b/heatclient/tests/unit/test_template_utils.py @@ -11,11 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import base64 import json import tempfile import mock +from oslo_serialization import base64 import six from six.moves.urllib import error import testtools @@ -715,7 +715,7 @@ class TestGetTemplateContents(testtools.TestCase): 'content': {'get_file': url}, 'encoding': 'b64'}]}}}}} with mock.patch('six.moves.urllib.request.urlopen') as mock_url: - raw_content = base64.decodestring(content) + raw_content = base64.decode_as_bytes(content) response = six.BytesIO(raw_content) mock_url.return_value = response files = {} @@ -732,8 +732,8 @@ t9SdXgLAAEE\n6AMAAATpAwAAaGVhdApQSwECHgMKAAAAAABGWVpEWzgLgQUAAAAF\ AAAACAAYAAAAAAABAAAApIEA\nAAAAaGVhdC50eHRVVAUAAxRbDVN1eAsAAQToAwA\ ABOkDAABQSwUGAAAAAAEAAQBOAAAARwAAAAAA\n''' # zip has '\0' in stream - self.assertIn(b'\0', base64.decodestring(content)) - decoded_content = base64.decodestring(content) + self.assertIn(b'\0', base64.decode_as_bytes(content)) + decoded_content = base64.decode_as_bytes(content) if six.PY3: self.assertRaises(UnicodeDecodeError, decoded_content.decode) else: @@ -748,8 +748,8 @@ ABOkDAABQSwUGAAAAAAEAAQBOAAAARwAAAAAA\n''' filename = 'heat.utf16' content = b'//4tTkhTCgA=\n' # utf6 has '\0' in stream - self.assertIn(b'\0', base64.decodestring(content)) - decoded_content = base64.decodestring(content) + self.assertIn(b'\0', base64.decode_as_bytes(content)) + decoded_content = base64.decode_as_bytes(content) if six.PY3: self.assertRaises(UnicodeDecodeError, decoded_content.decode) else: @@ -763,8 +763,8 @@ ABOkDAABQSwUGAAAAAAEAAQBOAAAARwAAAAAA\n''' filename = 'heat.gb18030' content = b'1tDO5wo=\n' # gb18030 has no '\0' in stream - self.assertNotIn('\0', base64.decodestring(content)) - decoded_content = base64.decodestring(content) + self.assertNotIn('\0', base64.decode_as_bytes(content)) + decoded_content = base64.decode_as_bytes(content) if six.PY3: self.assertRaises(UnicodeDecodeError, decoded_content.decode) else: |