Replace deprecated "decodestring"
decodestring() is a deprecated alias, use decodebytes()
https://docs.python.org/3.1/library/base64.html#base64.decodestring
This patch helps to remove this deprecation alias by
replacing "base64.decodestring" with "oslo_serialization.base64.decode_as_bytes".
The same has been done for nova:
https://review.openstack.org/#/c/610401/
Change-Id: Ibba785b8f9b27a74344c27dc952a8782f10fa697
diff --git a/tempest/lib/common/jsonschema_validator.py b/tempest/lib/common/jsonschema_validator.py
index 9a35b76..bbf5e89 100644
--- a/tempest/lib/common/jsonschema_validator.py
+++ b/tempest/lib/common/jsonschema_validator.py
@@ -12,9 +12,8 @@
# 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 base64
-
import jsonschema
+from oslo_serialization import base64
from oslo_utils import timeutils
import six
@@ -46,9 +45,7 @@
try:
if isinstance(instance, six.text_type):
instance = instance.encode('utf-8')
- base64.decodestring(instance)
- except base64.binascii.Error:
- return False
+ base64.decode_as_bytes(instance)
except TypeError:
# The name must be string type. If instance isn't string type, the
# TypeError will be raised at here.