-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Viktor Bozhinov
committed
Jan 7, 2022
1 parent
8267de0
commit 85c4bfc
Showing
2 changed files
with
117 additions
and
24 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,28 @@ | ||
import json | ||
|
||
import datagateway_api.src.search_api.models as models | ||
|
||
|
||
class TestModels: | ||
def test_from_icat_person_model(self): | ||
expected_model_data = { | ||
"id": "1", | ||
"fullName": "Test fullname", | ||
"orcid": "1111", | ||
"researcherId": None, | ||
"firstName": "Test given name", | ||
"lastName": "Test family name", | ||
"members": None, | ||
} | ||
# TODO: `id` is returned as `int` from ICAT whereas Person model expects `str` | ||
icat_data = { | ||
"id": "1", | ||
"fullName": "Test fullname", | ||
"orcidId": "1111", | ||
"givenName": "Test given name", | ||
"familyName": "Test family name", | ||
} | ||
|
||
person_model = models.Person.from_icat(icat_data) | ||
|
||
assert person_model.json(by_alias=True) == json.dumps(expected_model_data) |