-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use token instead of username and password (#14)
- Loading branch information
Showing
4 changed files
with
48 additions
and
3 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -97,6 +97,17 @@ def test_error500(self) -> None: | |
api.authenticate() | ||
assert e_info.value.__str__() == "Request failed: <Response [500]>" | ||
|
||
def test_initialize_token(self) -> None: | ||
"""Test initialize token.""" | ||
api = APIHelper(token="token") | ||
assert api._token == "token" | ||
|
||
def test_set_token(self) -> None: | ||
"""Test set token.""" | ||
api = APIHelper(token="token") | ||
api.set_token("new_token") | ||
assert api._token == "new_token" | ||
|
||
def test_authenticate_success(self) -> None: | ||
"""Test authentication success.""" | ||
with patch( | ||
|
@@ -106,6 +117,11 @@ def test_authenticate_success(self) -> None: | |
api = APIHelper("[email protected]", "password") | ||
assert api.authenticate() | ||
|
||
def test_authenticate_fail_empty_credentials(self) -> None: | ||
"""Test authentication failed.""" | ||
api = APIHelper(None, None) | ||
assert not api.authenticate() | ||
|
||
def test_authenticate_failed(self) -> None: | ||
"""Test authentication failed.""" | ||
with patch( | ||
|