refactor: move platform API database queries to service layer
- Create platform_signup_service.py for signup flow operations - Create platform_pricing_service.py for pricing data operations - Refactor signup.py, pricing.py, letzshop_vendors.py to use services - Add # public markers to all platform endpoints - Update tests for correct mock paths and status codes Fixes architecture validation errors (API-002, API-003, SVC-006). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ from models.database.vendor import Vendor
|
||||
@pytest.fixture
|
||||
def mock_stripe_service():
|
||||
"""Mock the Stripe service for tests."""
|
||||
with patch("app.api.v1.platform.signup.stripe_service") as mock:
|
||||
with patch("app.services.platform_signup_service.stripe_service") as mock:
|
||||
mock.create_customer.return_value = "cus_test_123"
|
||||
mock.create_setup_intent.return_value = MagicMock(
|
||||
id="seti_test_123",
|
||||
@@ -147,7 +147,7 @@ class TestSignupStartAPI:
|
||||
json={"tier_code": "invalid_tier", "is_annual": False},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 422 # ValidationException
|
||||
data = response.json()
|
||||
assert "invalid tier" in data["message"].lower()
|
||||
|
||||
@@ -226,7 +226,7 @@ class TestClaimVendorAPI:
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 409 # ConflictException
|
||||
data = response.json()
|
||||
assert "already claimed" in data["message"].lower()
|
||||
|
||||
@@ -309,7 +309,7 @@ class TestCreateAccountAPI:
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 409 # ConflictException
|
||||
data = response.json()
|
||||
assert "already exists" in data["message"].lower()
|
||||
|
||||
@@ -414,7 +414,7 @@ class TestSetupPaymentAPI:
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 422 # ValidationException
|
||||
data = response.json()
|
||||
assert "account not created" in data["message"].lower()
|
||||
|
||||
@@ -514,7 +514,7 @@ class TestCompleteSignupAPI:
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 422 # ValidationException
|
||||
data = response.json()
|
||||
assert "not completed" in data["message"].lower()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user