-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from dknowles2/user-name
Handle the case where friendlyName is None
- Loading branch information
Showing
3 changed files
with
13 additions
and
5 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
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
from unittest import mock | ||
from __future__ import annotations | ||
|
||
from pyschlage.user import User | ||
|
||
|
||
def test_from_json(lock_users_json): | ||
def test_from_json(lock_users_json: list[dict]): | ||
user = User( | ||
name="asdf", | ||
email="[email protected]", | ||
user_id="user-uuid", | ||
) | ||
assert User.from_json(lock_users_json[0]) == user | ||
|
||
|
||
def test_from_json_no_name(lock_users_json: list[dict]): | ||
for user_json in lock_users_json: | ||
user_json.pop("friendlyName") | ||
assert User.from_json(user_json).name is None |