Phase 7: End-to-End API Testing - Database setup, migrations, and application fixes
- Switched from psycopg2 to asyncpg for async SQLAlchemy support - Fixed router registration in main.py - removed duplicate prefixes - Added user_data export to routers/__init__.py - Refactored decks router to use DeckManager service layer - Integrated FuzzyCardMatcher into card_router search endpoints - Made WishlistCreate.card_id optional for proper schema validation - Set PostgreSQL password and configured scram-sha-256 auth - Updated alembic.ini to use local PostgreSQL instead of Docker hostname - Created generic_schemas.py for reusable schema patterns - Added test_routers.py and test_schema_validation.py test files - All 6 Alembic migrations applied successfully (37 tables created) - Application running on port 8000 with all services connected
This commit is contained in:
@@ -19,8 +19,6 @@ from app.schemas.user_data_schemas import (
|
||||
GameReplayCreate, GameReplayUpdate, GameReplayResponse, GameReplayListResponse,
|
||||
GameOutcomeCreate, GameOutcomeResponse, GameOutcomeListResponse,
|
||||
UserStatisticsResponse, StatisticsUpdateResponse,
|
||||
CardCollectionCreate, CardCollectionUpdate, CardCollectionResponse, CardCollectionListResponse,
|
||||
WishlistCreate, WishlistUpdate, WishlistResponse, WishlistListResponse,
|
||||
GroupCreate, GroupUpdate, GroupMemberCreate, GroupMemberUpdate, GroupMemberRemove,
|
||||
GroupResponse, GroupListResponse, GroupChatMessageCreate, GroupChatMessageResponse, GroupChatMessageListResponse,
|
||||
NetworkCreate, NetworkUpdate, NetworkMemberCreate,
|
||||
@@ -29,6 +27,12 @@ from app.schemas.user_data_schemas import (
|
||||
ActivityLogEntry, ActivityLogListResponse,
|
||||
MessageResponse, CountResponse, ErrorDetail,
|
||||
)
|
||||
from app.schemas.user_card_collection import (
|
||||
CardCondition, AcquisitionMethod,
|
||||
CardCollectionCreate, CardCollectionUpdate, CardCollectionResponse, CardCollectionListResponse,
|
||||
WishlistCreate, WishlistUpdate, WishlistResponse, WishlistListResponse,
|
||||
CollectionStatistics, CollectionSummaryResponse,
|
||||
)
|
||||
from app.schemas.user_deck_schemas import (
|
||||
DeckStatus, DeckZone, SuggestionType,
|
||||
UserDeckCreate, UserDeckUpdate, UserDeckResponse, UserDeckListResponse,
|
||||
@@ -36,20 +40,30 @@ from app.schemas.user_deck_schemas import (
|
||||
PrecedentCreate, PrecedentUpdate, PrecedentResponse, PrecedentListResponse,
|
||||
SuggestionCreate, SuggestionResponse, SuggestionListResponse,
|
||||
DeckFinalizeRequest, DeckFinalizeResponse, DeckDeleteResponse,
|
||||
CardSearchRequest, CardSearchResponse,
|
||||
)
|
||||
from app.schemas.user_card_collection import (
|
||||
CardCondition, AcquisitionMethod,
|
||||
CollectionStatistics, CollectionSummaryResponse,
|
||||
CardSearchRequest,
|
||||
)
|
||||
from app.schemas.card_import_schemas import (
|
||||
CardImportRequest, CardImportResponse, CardImportStatusResponse,
|
||||
CardMatchResult, CardImportSummary,
|
||||
CardImportRequest, CardImportResponse as CardImportResponseV2, CardImportStatusResponse as CardImportStatusResponseV2,
|
||||
CardMatchResult as CardMatchResultV2, CardImportSummary as CardImportSummaryV2,
|
||||
CardImportBatchCreate, CardImportBatchResponse,
|
||||
UserCardImportCreate, UserCardImportResponse, UserCardImportRecordResponse,
|
||||
)
|
||||
from app.schemas.card_search_schemas import (
|
||||
CardResponse, SetResponse, CardTypeResponse,
|
||||
CardSearchResponse as CardSearchResponseV2,
|
||||
CardImportResponse as CardImportResponseV3,
|
||||
CardImportStatusResponse as CardImportStatusResponseV3,
|
||||
CardMatchResult as CardMatchResultV3,
|
||||
CardImportSummary as CardImportSummaryV3,
|
||||
)
|
||||
from app.schemas.game_schemas import (
|
||||
GameCreate as GameCreateV2, GameResponse as GameResponseV2, GameJoinRequest, GameLeaveRequest,
|
||||
GameListResponse, GamePlayerResponse, GameStateResponse,
|
||||
)
|
||||
from app.schemas.mtg_card_schemas import (
|
||||
MtgCardResponse, MtgCardSearchRequest, MtgCardSearchResponse,
|
||||
MtgSetResponse, MtgCardMirrorResponse,
|
||||
DeckCardLinkResponse as DeckCardLinkResponseV2, DeckWithCardsResponse as DeckWithCardsResponseV2,
|
||||
)
|
||||
from app.schemas.proto_messages import (
|
||||
ProtoMessageBase, SessionCommand, GameCommand, GameEvent, Response,
|
||||
@@ -60,14 +74,6 @@ from app.schemas.protocol_constants import (
|
||||
SessionCommandType, GameCommandType, GameEventType, ResponseCode,
|
||||
ZoneType, UserLevelFlag,
|
||||
)
|
||||
from app.schemas.game_schemas import (
|
||||
GameCreate, GameResponse, GameJoinRequest, GameLeaveRequest,
|
||||
GameListResponse, GamePlayerResponse, GameStateResponse,
|
||||
)
|
||||
from app.schemas.mtg_card_schemas import (
|
||||
MtgCardResponse, MtgCardSearchRequest, MtgCardSearchResponse,
|
||||
MtgSetResponse, MtgCardMirrorResponse, DeckCardLinkResponse, DeckWithCardsResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Auth
|
||||
@@ -96,8 +102,6 @@ __all__ = [
|
||||
"GameReplayCreate", "GameReplayUpdate", "GameReplayResponse", "GameReplayListResponse",
|
||||
"GameOutcomeCreate", "GameOutcomeResponse", "GameOutcomeListResponse",
|
||||
"UserStatisticsResponse", "StatisticsUpdateResponse",
|
||||
"CardCollectionCreate", "CardCollectionUpdate", "CardCollectionResponse", "CardCollectionListResponse",
|
||||
"WishlistCreate", "WishlistUpdate", "WishlistResponse", "WishlistListResponse",
|
||||
"GroupCreate", "GroupUpdate", "GroupMemberCreate", "GroupMemberUpdate", "GroupMemberRemove",
|
||||
"GroupResponse", "GroupListResponse", "GroupChatMessageCreate", "GroupChatMessageResponse", "GroupChatMessageListResponse",
|
||||
"NetworkCreate", "NetworkUpdate", "NetworkMemberCreate",
|
||||
@@ -105,6 +109,11 @@ __all__ = [
|
||||
"UserPreferenceUpdate", "UserPreferenceResponse",
|
||||
"ActivityLogEntry", "ActivityLogListResponse",
|
||||
"MessageResponse", "CountResponse", "ErrorDetail",
|
||||
# Card Collection
|
||||
"CardCondition", "AcquisitionMethod",
|
||||
"CardCollectionCreate", "CardCollectionUpdate", "CardCollectionResponse", "CardCollectionListResponse",
|
||||
"WishlistCreate", "WishlistUpdate", "WishlistResponse", "WishlistListResponse",
|
||||
"CollectionStatistics", "CollectionSummaryResponse",
|
||||
# User Deck
|
||||
"DeckStatus", "DeckZone", "SuggestionType",
|
||||
"UserDeckCreate", "UserDeckUpdate", "UserDeckResponse", "UserDeckListResponse",
|
||||
@@ -113,16 +122,21 @@ __all__ = [
|
||||
"SuggestionCreate", "SuggestionResponse", "SuggestionListResponse",
|
||||
"DeckFinalizeRequest", "DeckFinalizeResponse", "DeckDeleteResponse",
|
||||
"CardSearchRequest", "CardSearchResponse",
|
||||
# Card Collection
|
||||
"CardCondition", "AcquisitionMethod",
|
||||
"CollectionStatistics", "CollectionSummaryResponse",
|
||||
# Card Import
|
||||
"CardImportRequest", "CardImportResponse", "CardImportStatusResponse",
|
||||
"CardMatchResult", "CardImportSummary",
|
||||
"CardImportRequest", "CardImportResponseV2", "CardImportStatusResponseV2",
|
||||
"CardMatchResultV2", "CardImportSummaryV2",
|
||||
"CardImportBatchCreate", "CardImportBatchResponse",
|
||||
"UserCardImportCreate", "UserCardImportResponse", "UserCardImportRecordResponse",
|
||||
# Card Search
|
||||
"CardResponse", "SetResponse", "CardTypeResponse",
|
||||
"CardSearchResponseV2", "CardImportResponseV3", "CardImportStatusResponseV3",
|
||||
"CardMatchResultV3", "CardImportSummaryV3",
|
||||
# Game Schemas
|
||||
"GameCreateV2", "GameResponseV2",
|
||||
# MTG Card Schemas
|
||||
"MtgCardResponse", "MtgCardSearchRequest", "MtgCardSearchResponse",
|
||||
"MtgSetResponse", "MtgCardMirrorResponse",
|
||||
"DeckCardLinkResponseV2", "DeckWithCardsResponseV2",
|
||||
# Proto Messages
|
||||
"ProtoMessageBase", "SessionCommand", "GameCommand", "GameEvent", "Response",
|
||||
"ServerInfoUser", "ServerInfoDeckStorageFile", "ServerInfoDeckStorageFolder",
|
||||
|
||||
Reference in New Issue
Block a user