-
Notifications
You must be signed in to change notification settings - Fork 8
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
clubby789
committed
Oct 26, 2021
1 parent
e489eb0
commit baae4ed
Showing
1 changed file
with
2 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from pytest import raises | ||
from hackthebox.htb import HTBClient | ||
|
||
from hackthebox import errors | ||
from hackthebox.htb import HTBClient | ||
|
||
|
||
def test_login(mock_htb_client: HTBClient): | ||
|
@@ -18,22 +19,11 @@ def test_otp_login(): | |
# Wait for server thread to start | ||
time.sleep(0.5) | ||
|
||
with raises(errors.MissingOTPException): | ||
HTBClient(email="[email protected]", password="password", api_base=f"http://localhost:{port}/api/v4/") | ||
with raises(errors.IncorrectOTPException): | ||
HTBClient(email="[email protected]", password="password", otp=555555, api_base=f"http://localhost:{port}/api/v4/") | ||
HTBClient(email="[email protected]", password="password", otp=111111, api_base=f"http://localhost:{port}/api/v4/") | ||
|
||
|
||
def test_incorrect_login(): | ||
with raises(errors.AuthenticationException): | ||
HTBClient() | ||
with raises(errors.AuthenticationException): | ||
HTBClient(password="wrong") | ||
with raises(errors.AuthenticationException): | ||
HTBClient(email="[email protected]") | ||
|
||
|
||
def test_get_own_user(mock_htb_client: HTBClient): | ||
assert mock_htb_client.user is not None | ||
|
||
|