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']