Project-Stage-Academy / UA1244_beta

1 stars 0 forks source link

Write unit tests and integration tests and Documenation #118

Closed Chelakhovl closed 3 weeks ago

Chelakhovl commented 3 weeks ago

This PR adds comprehensive documentation for configuring OAuth authentication and updates the README with instructions for setting up Google as an OAuth provider. Additionally, unit and integration tests were added to verify the login flow, JWT token issuance, and user account handling during OAuth login. Changes Made: Updated README Documentation: OAuth Setup Instructions: Detailed setup guide for configuring Google as an OAuth provider, with step-by-step instructions on obtaining and using Google API credentials. Login Flow and JWT Token Issuance: Explanation of the login flow when using Google OAuth, including token exchange, user profile retrieval, and JWT token issuance. Troubleshooting Section: Common issues and troubleshooting tips to assist developers in resolving configuration or runtime issues. Covers frequent errors such as missing provider/code, failed access token retrieval, unsupported provider, and inactive user accounts. Unit and Integration Tests for OAuth Login and JWT Issuance: OAuth Login Flow Tests: Tests the login flow using Google OAuth to ensure the correct handling of authorization codes and token exchange. JWT Token Issuance Verification: Verifies that JWT tokens (access and refresh) are correctly issued after successful OAuth authentication. User Creation and Update Tests: Checks that user accounts are created and updated as expected during OAuth login, including activation and token refresh. Testing: All tests have been written using Django's APITestCase and mock libraries to simulate OAuth responses. These tests verify that the OAuth authentication flow works as expected, including token issuance and user handling. Tests were successfully executed, and all are passing. 1