freeleaps-service-hub/apps/authentication/tests/api_tests/siginin
2025-07-22 17:14:30 +08:00
..
__init__.py feat(role_management): Add pytest for auth services, and add api test case for role management 2025-07-21 17:51:08 +08:00
config.py feat(role_management): add api test case for permission api 2025-07-22 10:28:05 +08:00
conftest.py feat(role_management): Add pytest for auth services, and add api test case for role management 2025-07-21 17:51:08 +08:00
README.md feat(role_management): add test report for role management 2025-07-22 17:14:30 +08:00
test_signin_with_email_and_password.py feat(role_management): add api test case for permission api 2025-07-22 10:28:05 +08:00

Signin API Test Report

How to Run the Tests

Run all signin API tests:

pytest --tb=short tests/api_tests/siginin/

Test Results Summary

  • Total tests collected: 1
  • All tests passed.
  • Warnings:
    • Deprecation warning from Pydantic (upgrade recommended for future compatibility).

Test Case Explanations

test_signin_with_email_and_password.py

  • test_sign_in_with_email_and_password
    This test verifies the email and password sign-in flow:
    • Calls the login API with valid credentials.
    • Asserts that the response contains a valid access token, refresh token, expiration, identity, role names, and user permissions.
    • Decodes the JWT access token and checks that the payload contains the expected subject fields (id, role_names, user_permissions).

Summary

  • This test ensures that the email/password sign-in API returns all required authentication and user information fields, and that the JWT token is correctly structured.
  • If you need to add more signin scenarios, add new test cases to this directory and re-run the tests.