-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set up model classes to ignore unknown dict keys
- Loading branch information
1 parent
3dcb5de
commit fbeb468
Showing
3 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from sign_client.model import UserGroupsInfo | ||
import json | ||
|
||
def test_deserialize(): | ||
"""Test deserialization of a Sign API response""" | ||
# `widgetCreationVisible` is not part of the UserGroupsInfo | ||
# test will pass if user_groups_info is constructed with no errors | ||
|
||
# user permission info | ||
api_resp_json = """ | ||
{ | ||
"groupInfoList": [ | ||
{ | ||
"id": "", | ||
"isGroupAdmin": false, | ||
"isPrimaryGroup": false, | ||
"status": "", | ||
"createdDate": "date", | ||
"name": "", | ||
"settings": { | ||
"libaryDocumentCreationVisible": { | ||
"value": false, | ||
"inherited": false | ||
}, | ||
"sendRestrictedToWorkflows": { | ||
"value": false, | ||
"inherited": false | ||
}, | ||
"userCanSend": { | ||
"value": false, | ||
"inherited": false | ||
}, | ||
"widgetCreationVisible": { | ||
"value": false, | ||
"inherited": false | ||
} | ||
} | ||
} | ||
] | ||
} | ||
""" | ||
dct = json.loads(api_resp_json) | ||
UserGroupsInfo.from_dict(dct) |