From 5e6416d4b57e94e9cb5d64f576eeb3322cb49242 Mon Sep 17 00:00:00 2001 From: Paul Montgomery Date: Wed, 27 Jan 2021 11:32:27 -0800 Subject: [PATCH] Fix base64 encoding (#302) * Fix base64 encoding issues (binary string - regular string) * Update version and History * PR feedback --- HISTORY.rst | 7 +++++++ azext_iot/constants.py | 2 +- azext_iot/product/test/command_tests.py | 5 ++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 289c87a00..d0237e16c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +0.10.9 ++++++++++++++++ + +**Azure IoT Product Certification service** + +* Fix bug for `az iot product test create` sending a byte string instead of "regular" base64 string. + 0.10.8 +++++++++++++++ diff --git a/azext_iot/constants.py b/azext_iot/constants.py index 4e30e223b..8b8f419db 100644 --- a/azext_iot/constants.py +++ b/azext_iot/constants.py @@ -7,7 +7,7 @@ import os -VERSION = "0.10.8" +VERSION = "0.10.9" EXTENSION_NAME = "azure-iot" EXTENSION_ROOT = os.path.dirname(os.path.abspath(__file__)) EXTENSION_CONFIG_ROOT_KEY = "iotext" diff --git a/azext_iot/product/test/command_tests.py b/azext_iot/product/test/command_tests.py index 7d73a351c..3e5cb9948 100644 --- a/azext_iot/product/test/command_tests.py +++ b/azext_iot/product/test/command_tests.py @@ -278,9 +278,8 @@ def _read_certificate_from_file(certificate_path): with open(file=certificate_path, mode="rb") as f: data = f.read() - from base64 import encodestring # pylint: disable=no-name-in-module - - return encodestring(data) + from base64 import b64encode # pylint: disable=no-name-in-module + return b64encode(data).decode('utf-8') def _create_from_file(configuration_file):