Initial implementation of OAuth models, endpoints, and migrations

- Added models for `OAuthClient`, `OAuthState`, and `OAuthAccount`.
- Created Pydantic schemas to support OAuth flows, client management, and linked accounts.
- Implemented skeleton endpoints for OAuth Provider mode: authorization, token, and revocation.
- Updated router imports to include new `/oauth` and `/oauth/provider` routes.
- Added Alembic migration script to create OAuth-related database tables.
- Enhanced `users` table to allow OAuth-only accounts by making `password_hash` nullable.
This commit is contained in:
Felipe Cardoso
2025-11-25 00:37:23 +01:00
parent e6792c2d6c
commit 16ee4e0cb3
23 changed files with 4109 additions and 13 deletions

View File

@@ -169,10 +169,17 @@ class TestJWTConfiguration:
class TestProjectConfiguration:
"""Tests for project-level configuration"""
def test_project_name_default(self):
"""Test that project name is set correctly"""
def test_project_name_can_be_set(self):
"""Test that project name can be explicitly set"""
settings = Settings(SECRET_KEY="a" * 32, PROJECT_NAME="TestApp")
assert settings.PROJECT_NAME == "TestApp"
def test_project_name_is_set(self):
"""Test that project name has a value (from default or environment)"""
settings = Settings(SECRET_KEY="a" * 32)
assert settings.PROJECT_NAME == "PragmaStack"
# PROJECT_NAME should be a non-empty string
assert isinstance(settings.PROJECT_NAME, str)
assert len(settings.PROJECT_NAME) > 0
def test_api_version_string(self):
"""Test that API version string is correct"""