Add CRUD operations for users with tests and fixtures
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 54s
Build and Push Docker Images / build-frontend (push) Has been skipped

Implemented user CRUD operations including creation, retrieval, updating, and deletion through a generic CRUD base class. Enhanced user schemas with additional attributes and created tests to verify functionality, covering edge cases such as duplicates and pagination. Updated the test suite with new fixtures and methods to support the tests.
This commit is contained in:
2025-03-04 18:33:33 +01:00
parent c6fe040f21
commit 7d9f4ee4b2
7 changed files with 260 additions and 5 deletions

View File

@@ -38,6 +38,18 @@ async def async_test_db():
yield test_engine, AsyncTestingSessionLocal
await teardown_async_test_db(test_engine)
@pytest.fixture
def user_create_data():
return {
"email": "newtest@example.com", # Changed to avoid conflict with mock_user
"password": "TestPassword123!",
"first_name": "Test",
"last_name": "User",
"phone_number": "+1234567890",
"is_superuser": False,
"preferences": None
}
@pytest.fixture
def mock_user(db_session):
@@ -50,7 +62,8 @@ def mock_user(db_session):
last_name="User",
phone_number="1234567890",
is_active=True,
is_superuser=False
is_superuser=False,
preferences=None,
)
db_session.add(mock_user)
db_session.commit()