From 8081014710fc30ea53c9c43b68683c33327b3d93 Mon Sep 17 00:00:00 2001 From: Lakshman Sundaralingam Date: Thu, 4 Feb 2021 18:53:02 -0800 Subject: [PATCH] Fix replace keys for nested json --- .../azure-communication-identity/tests/_shared/testcase.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py index c06c0bf5b1a5..bd1fbecc5750 100644 --- a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py +++ b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py @@ -51,13 +51,12 @@ def process_response(self, response): def _replace_keys(self, body): def _replace_recursively(dictionary): - if type(dictionary) != dict: - return for key in dictionary: + value = dictionary[key] if key in self._keys: dictionary[key] = self._replacement - else: - _replace_recursively(dictionary[key]) + elif isinstance(value, dict): + _replace_recursively(value) import json try: