You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
from datetime import datetime
|
|
|
|
import rfc3339
|
|
|
|
from tests.conftest import AuthActions
|
|
|
|
|
|
def test_login_happy_path(auth: AuthActions):
|
|
result = auth.login()
|
|
assert result.status_code == 200
|
|
assert result.json['token'] is not None and len(result.json['token']) > 0
|
|
|
|
|
|
def test_login_happy_path_with_options(auth: AuthActions):
|
|
token_note = 'Test Note'
|
|
token_expiration_time = datetime.now()
|
|
result = auth.login(token_note, token_expiration_time)
|
|
assert result.status_code == 200
|
|
assert result.json['token'] is not None and len(result.json['token']) > 0
|
|
assert result.json['note'] == token_note
|
|
assert result.json['expirationTime'] == rfc3339.format(
|
|
token_expiration_time)
|
|
|
|
|
|
def test_bump_happy_path(auth: AuthActions):
|
|
auth.login()
|
|
result = auth.bump()
|
|
assert result.status_code == 200
|
|
assert (result.json['lastLoginTime'] is not None
|
|
and len(result.json['lastLoginTime']) > 0)
|
|
|
|
|
|
def test_logout_happy_path(auth: AuthActions):
|
|
auth.login()
|
|
result = auth.logout()
|
|
assert result.status_code == 200
|
|
assert result.json['success']
|