An ebook/comic library service and web client
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

  1. from datetime import datetime
  2. import rfc3339
  3. from tests.conftest import AuthActions
  4. def test_login_happy_path(auth: AuthActions):
  5. result = auth.login()
  6. assert result.status_code == 200
  7. assert result.json['token'] is not None and len(result.json['token']) > 0
  8. def test_login_happy_path_with_options(auth: AuthActions):
  9. token_note = 'Test Note'
  10. token_expiration_time = datetime.now()
  11. result = auth.login(token_note, token_expiration_time)
  12. assert result.status_code == 200
  13. assert result.json['token'] is not None and len(result.json['token']) > 0
  14. assert result.json['note'] == token_note
  15. assert result.json['expirationTime'] == rfc3339.format(
  16. token_expiration_time)
  17. def test_bump_happy_path(auth: AuthActions):
  18. auth.login()
  19. result = auth.bump()
  20. assert result.status_code == 200
  21. assert (result.json['lastLoginTime'] is not None
  22. and len(result.json['lastLoginTime']) > 0)
  23. def test_logout_happy_path(auth: AuthActions):
  24. auth.login()
  25. result = auth.logout()
  26. assert result.status_code == 200
  27. assert result.json['success']