refactor all dict methods

This commit is contained in:
lpm0073
2022-10-06 13:05:02 -05:00
parent 9ef6849a1e
commit 01c697717b
2 changed files with 30 additions and 56 deletions

View File

@ -1,12 +1,13 @@
import json
# Opening JSON file
f = open('get_user_details_extended.json')
# returns JSON object as
f = open("get_user_details_extended.json")
# returns JSON object as
# a dictionary
response = json.load(f)
def is_valid_user_details(response) -> bool:
"""
validate that the object passed is a dict containing at least the keys
@ -27,6 +28,7 @@ def is_valid_user_details(response) -> bool:
return True
return False
def is_wp_oauth_refresh_token_response(response) -> bool:
"""
validate that the structure of the response contains the keys of
@ -39,10 +41,9 @@ def is_wp_oauth_refresh_token_response(response) -> bool:
return True
return False
print('is_valid_user_details')
print("is_valid_user_details")
print(is_valid_user_details(response))
print('is_wp_oauth_refresh_token_response')
print("is_wp_oauth_refresh_token_response")
print(is_wp_oauth_refresh_token_response(response))