Add Google OAuth integration and tests #2139
Open
+99
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR adds Google OAuth support to the project and includes corresponding test cases. The following changes were made:
Frontend:
Minor updates to login pages to integrate Google OAuth buttons.
Settings:
Updated settings_global.py placeholders to include the ENABLE_SOCIAL_LOGIN flag.
Note: Actual OAuth credentials (client ID/secret) are intentionally excluded from the repo as the settings_global.py file is in .gitignore. These must be configured by project administrators.
URLs:
Added necessary URL patterns for Google OAuth login.
Tests:
Added wger/core/tests/test_google_oauth.py with unit tests for:
Presence of the OAuth URLs.
Feature flag definition.
Ensuring existing login functionality is unaffected.
Tests currently use placeholders to prevent exposing real credentials.
Rationale:
Google OAuth integration enhances user authentication options.
Added tests support regression checking and ensure the feature flag mechanism is working.
Settings placeholders maintain security and allow project administrators to configure credentials safely.
Additional Notes:
All OAuth-related pages require setup by project administrators; no sensitive credentials are included in the repository.
Tests run successfully with placeholders but will require valid credentials for full end-to-end verification.