refactor: migrate templates and static files to self-contained modules
Templates Migration: - Migrate admin templates to modules (tenancy, billing, monitoring, marketplace, etc.) - Migrate vendor templates to modules (tenancy, billing, orders, messaging, etc.) - Migrate storefront templates to modules (catalog, customers, orders, cart, checkout, cms) - Migrate public templates to modules (billing, marketplace, cms) - Keep shared templates in app/templates/ (base.html, errors/, partials/, macros/) - Migrate letzshop partials to marketplace module Static Files Migration: - Migrate admin JS to modules: tenancy (23 files), core (5 files), monitoring (1 file) - Migrate vendor JS to modules: tenancy (4 files), core (2 files) - Migrate shared JS: vendor-selector.js to core, media-picker.js to cms - Migrate storefront JS: storefront-layout.js to core - Keep framework JS in static/ (api-client, utils, money, icons, log-config, lib/) - Update all template references to use module_static paths Naming Consistency: - Rename static/platform/ to static/public/ - Rename app/templates/platform/ to app/templates/public/ - Update all extends and static references Documentation: - Update module-system.md with shared templates documentation - Update frontend-structure.md with new module JS organization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -178,7 +178,7 @@ class TestAdminLetzshopCredentialsAPI:
|
||||
class TestAdminLetzshopConnectionAPI:
|
||||
"""Test admin Letzshop connection testing endpoints."""
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_test_vendor_connection(
|
||||
self, mock_post, client, admin_headers, test_vendor
|
||||
):
|
||||
@@ -206,7 +206,7 @@ class TestAdminLetzshopConnectionAPI:
|
||||
data = response.json()
|
||||
assert data["success"] is True
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_test_api_key_directly(self, mock_post, client, admin_headers):
|
||||
"""Test any API key without associating with vendor."""
|
||||
mock_response = MagicMock()
|
||||
@@ -290,7 +290,7 @@ class TestAdminLetzshopOrdersAPI:
|
||||
assert data["total"] == 1
|
||||
assert data["orders"][0]["customer_email"] == "admin-test@example.com"
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_trigger_vendor_sync(self, mock_post, client, admin_headers, test_vendor):
|
||||
"""Test triggering sync for a vendor."""
|
||||
# Mock response
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# tests/integration/api/v1/platform/__init__.py
|
||||
"""Platform API integration tests."""
|
||||
@@ -0,0 +1,8 @@
|
||||
# tests/integration/api/v1/public/__init__.py
|
||||
"""Public API integration tests.
|
||||
|
||||
Tests for unauthenticated public endpoints:
|
||||
- /api/v1/public/signup/* - Multi-step signup flow
|
||||
- /api/v1/public/pricing/* - Subscription tiers and pricing
|
||||
- /api/v1/public/letzshop-vendors/* - Vendor lookup for signup
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# tests/integration/api/v1/platform/test_letzshop_vendors.py
|
||||
# tests/integration/api/v1/public/test_letzshop_vendors.py
|
||||
"""Integration tests for platform Letzshop vendor lookup API endpoints.
|
||||
|
||||
Tests the /api/v1/platform/letzshop-vendors/* endpoints.
|
||||
Tests the /api/v1/public/letzshop-vendors/* endpoints.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@@ -62,15 +62,15 @@ def claimed_vendor(db, test_company):
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestLetzshopVendorLookupAPI:
|
||||
"""Test Letzshop vendor lookup endpoints at /api/v1/platform/letzshop-vendors/*."""
|
||||
"""Test Letzshop vendor lookup endpoints at /api/v1/public/letzshop-vendors/*."""
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/letzshop-vendors
|
||||
# GET /api/v1/public/letzshop-vendors
|
||||
# =========================================================================
|
||||
|
||||
def test_list_vendors_returns_empty_list(self, client):
|
||||
"""Test listing vendors returns empty list (placeholder)."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors")
|
||||
response = client.get("/api/v1/public/letzshop-vendors")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -83,7 +83,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
|
||||
def test_list_vendors_with_pagination(self, client):
|
||||
"""Test listing vendors with pagination parameters."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors?page=2&limit=10")
|
||||
response = client.get("/api/v1/public/letzshop-vendors?page=2&limit=10")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -92,7 +92,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
|
||||
def test_list_vendors_with_search(self, client):
|
||||
"""Test listing vendors with search parameter."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors?search=my-shop")
|
||||
response = client.get("/api/v1/public/letzshop-vendors?search=my-shop")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -101,7 +101,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_list_vendors_with_filters(self, client):
|
||||
"""Test listing vendors with category and city filters."""
|
||||
response = client.get(
|
||||
"/api/v1/platform/letzshop-vendors?category=fashion&city=luxembourg"
|
||||
"/api/v1/public/letzshop-vendors?category=fashion&city=luxembourg"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
@@ -111,17 +111,17 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_list_vendors_limit_validation(self, client):
|
||||
"""Test that limit parameter is validated."""
|
||||
# Maximum limit is 50
|
||||
response = client.get("/api/v1/platform/letzshop-vendors?limit=100")
|
||||
response = client.get("/api/v1/public/letzshop-vendors?limit=100")
|
||||
assert response.status_code == 422
|
||||
|
||||
# =========================================================================
|
||||
# POST /api/v1/platform/letzshop-vendors/lookup
|
||||
# POST /api/v1/public/letzshop-vendors/lookup
|
||||
# =========================================================================
|
||||
|
||||
def test_lookup_vendor_by_full_url(self, client):
|
||||
"""Test looking up vendor by full Letzshop URL."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/vendors/my-test-shop"},
|
||||
)
|
||||
|
||||
@@ -134,7 +134,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_by_url_with_language(self, client):
|
||||
"""Test looking up vendor by URL with language prefix."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/en/vendors/my-shop"},
|
||||
)
|
||||
|
||||
@@ -146,7 +146,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_by_url_without_protocol(self, client):
|
||||
"""Test looking up vendor by URL without https://."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "letzshop.lu/vendors/test-shop"},
|
||||
)
|
||||
|
||||
@@ -158,7 +158,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_by_slug_only(self, client):
|
||||
"""Test looking up vendor by slug alone."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "my-shop-name"},
|
||||
)
|
||||
|
||||
@@ -170,7 +170,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_normalizes_slug(self, client):
|
||||
"""Test that slug is normalized to lowercase."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/vendors/MY-SHOP-NAME"},
|
||||
)
|
||||
|
||||
@@ -181,7 +181,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_shows_claimed_status(self, client, claimed_vendor):
|
||||
"""Test that lookup shows if vendor is already claimed."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "claimed-shop"},
|
||||
)
|
||||
|
||||
@@ -193,7 +193,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_shows_unclaimed_status(self, client):
|
||||
"""Test that lookup shows if vendor is not claimed."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "unclaimed-new-shop"},
|
||||
)
|
||||
|
||||
@@ -205,7 +205,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_empty_url(self, client):
|
||||
"""Test lookup with empty URL."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": ""},
|
||||
)
|
||||
|
||||
@@ -217,7 +217,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
def test_lookup_vendor_response_has_expected_fields(self, client):
|
||||
"""Test that vendor lookup response has all expected fields."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "test-vendor"},
|
||||
)
|
||||
|
||||
@@ -230,12 +230,12 @@ class TestLetzshopVendorLookupAPI:
|
||||
assert "is_claimed" in vendor
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/letzshop-vendors/{slug}
|
||||
# GET /api/v1/public/letzshop-vendors/{slug}
|
||||
# =========================================================================
|
||||
|
||||
def test_get_vendor_by_slug(self, client):
|
||||
"""Test getting vendor by slug."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors/my-shop")
|
||||
response = client.get("/api/v1/public/letzshop-vendors/my-shop")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -246,7 +246,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
|
||||
def test_get_vendor_normalizes_slug(self, client):
|
||||
"""Test that get vendor normalizes slug to lowercase."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors/MY-SHOP")
|
||||
response = client.get("/api/v1/public/letzshop-vendors/MY-SHOP")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -254,7 +254,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
|
||||
def test_get_claimed_vendor_shows_status(self, client, claimed_vendor):
|
||||
"""Test that get vendor shows claimed status correctly."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors/claimed-shop")
|
||||
response = client.get("/api/v1/public/letzshop-vendors/claimed-shop")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -262,7 +262,7 @@ class TestLetzshopVendorLookupAPI:
|
||||
|
||||
def test_get_unclaimed_vendor_shows_status(self, client):
|
||||
"""Test that get vendor shows unclaimed status correctly."""
|
||||
response = client.get("/api/v1/platform/letzshop-vendors/new-unclaimed-shop")
|
||||
response = client.get("/api/v1/public/letzshop-vendors/new-unclaimed-shop")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -278,7 +278,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_full_https_url(self, client):
|
||||
"""Test extraction from https://letzshop.lu/vendors/slug."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/vendors/cafe-luxembourg"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "cafe-luxembourg"
|
||||
@@ -286,7 +286,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_http_url(self, client):
|
||||
"""Test extraction from http://letzshop.lu/vendors/slug."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "http://letzshop.lu/vendors/my-shop"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "my-shop"
|
||||
@@ -294,7 +294,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_url_with_trailing_slash(self, client):
|
||||
"""Test extraction from URL with trailing slash."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/vendors/my-shop/"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "my-shop"
|
||||
@@ -302,7 +302,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_url_with_query_params(self, client):
|
||||
"""Test extraction from URL with query parameters."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/vendors/my-shop?ref=google"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "my-shop"
|
||||
@@ -310,7 +310,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_french_url(self, client):
|
||||
"""Test extraction from French language URL."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/fr/vendors/boulangerie-paul"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "boulangerie-paul"
|
||||
@@ -318,7 +318,7 @@ class TestLetzshopSlugExtraction:
|
||||
def test_extract_from_german_url(self, client):
|
||||
"""Test extraction from German language URL."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/letzshop-vendors/lookup",
|
||||
"/api/v1/public/letzshop-vendors/lookup",
|
||||
json={"url": "https://letzshop.lu/de/vendors/backerei-muller"},
|
||||
)
|
||||
assert response.json()["vendor"]["slug"] == "backerei-muller"
|
||||
@@ -1,7 +1,7 @@
|
||||
# tests/integration/api/v1/platform/test_pricing.py
|
||||
# tests/integration/api/v1/public/test_pricing.py
|
||||
"""Integration tests for platform pricing API endpoints.
|
||||
|
||||
Tests the /api/v1/platform/pricing/* endpoints.
|
||||
Tests the /api/v1/public/pricing/* endpoints.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@@ -18,15 +18,15 @@ from app.modules.billing.models import (
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestPlatformPricingAPI:
|
||||
"""Test platform pricing endpoints at /api/v1/platform/*."""
|
||||
"""Test platform pricing endpoints at /api/v1/public/*."""
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/tiers
|
||||
# GET /api/v1/public/tiers
|
||||
# =========================================================================
|
||||
|
||||
def test_get_tiers_returns_all_public_tiers(self, client):
|
||||
"""Test getting all subscription tiers."""
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -35,7 +35,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tiers_has_expected_fields(self, client):
|
||||
"""Test that tier response has all expected fields."""
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -55,7 +55,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tiers_includes_essential(self, client):
|
||||
"""Test that Essential tier is included."""
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -64,7 +64,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tiers_includes_professional(self, client):
|
||||
"""Test that Professional tier is included and marked as popular."""
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -77,7 +77,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tiers_includes_enterprise(self, client):
|
||||
"""Test that Enterprise tier is included and marked appropriately."""
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -108,7 +108,7 @@ class TestPlatformPricingAPI:
|
||||
db.add(tier)
|
||||
db.commit()
|
||||
|
||||
response = client.get("/api/v1/platform/tiers")
|
||||
response = client.get("/api/v1/public/tiers")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -116,12 +116,12 @@ class TestPlatformPricingAPI:
|
||||
assert "test_tier" in tier_codes
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/tiers/{tier_code}
|
||||
# GET /api/v1/public/tiers/{tier_code}
|
||||
# =========================================================================
|
||||
|
||||
def test_get_tier_by_code_success(self, client):
|
||||
"""Test getting a specific tier by code."""
|
||||
response = client.get(f"/api/v1/platform/tiers/{TierCode.PROFESSIONAL.value}")
|
||||
response = client.get(f"/api/v1/public/tiers/{TierCode.PROFESSIONAL.value}")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -130,7 +130,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tier_by_code_essential(self, client):
|
||||
"""Test getting Essential tier details."""
|
||||
response = client.get(f"/api/v1/platform/tiers/{TierCode.ESSENTIAL.value}")
|
||||
response = client.get(f"/api/v1/public/tiers/{TierCode.ESSENTIAL.value}")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -139,19 +139,19 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_tier_by_code_not_found(self, client):
|
||||
"""Test getting a non-existent tier returns 404."""
|
||||
response = client.get("/api/v1/platform/tiers/nonexistent_tier")
|
||||
response = client.get("/api/v1/public/tiers/nonexistent_tier")
|
||||
|
||||
assert response.status_code == 404
|
||||
data = response.json()
|
||||
assert "not found" in data["message"].lower()
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/addons
|
||||
# GET /api/v1/public/addons
|
||||
# =========================================================================
|
||||
|
||||
def test_get_addons_empty_when_none_configured(self, client):
|
||||
"""Test getting add-ons when none are configured."""
|
||||
response = client.get("/api/v1/platform/addons")
|
||||
response = client.get("/api/v1/public/addons")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -173,7 +173,7 @@ class TestPlatformPricingAPI:
|
||||
db.add(addon)
|
||||
db.commit()
|
||||
|
||||
response = client.get("/api/v1/platform/addons")
|
||||
response = client.get("/api/v1/public/addons")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -197,7 +197,7 @@ class TestPlatformPricingAPI:
|
||||
db.add(addon)
|
||||
db.commit()
|
||||
|
||||
response = client.get("/api/v1/platform/addons")
|
||||
response = client.get("/api/v1/public/addons")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -236,7 +236,7 @@ class TestPlatformPricingAPI:
|
||||
db.add_all([active_addon, inactive_addon])
|
||||
db.commit()
|
||||
|
||||
response = client.get("/api/v1/platform/addons")
|
||||
response = client.get("/api/v1/public/addons")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -245,12 +245,12 @@ class TestPlatformPricingAPI:
|
||||
assert "inactive_addon" not in addon_codes
|
||||
|
||||
# =========================================================================
|
||||
# GET /api/v1/platform/pricing
|
||||
# GET /api/v1/public/pricing
|
||||
# =========================================================================
|
||||
|
||||
def test_get_pricing_returns_complete_info(self, client):
|
||||
"""Test getting complete pricing information."""
|
||||
response = client.get("/api/v1/platform/pricing")
|
||||
response = client.get("/api/v1/public/pricing")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -262,7 +262,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_pricing_includes_trial_days(self, client):
|
||||
"""Test that pricing includes correct trial period."""
|
||||
response = client.get("/api/v1/platform/pricing")
|
||||
response = client.get("/api/v1/public/pricing")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -270,7 +270,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_pricing_includes_annual_discount(self, client):
|
||||
"""Test that pricing includes annual discount info."""
|
||||
response = client.get("/api/v1/platform/pricing")
|
||||
response = client.get("/api/v1/public/pricing")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -278,7 +278,7 @@ class TestPlatformPricingAPI:
|
||||
|
||||
def test_get_pricing_tiers_not_empty(self, client):
|
||||
"""Test that pricing always includes tiers."""
|
||||
response = client.get("/api/v1/platform/pricing")
|
||||
response = client.get("/api/v1/public/pricing")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -1,7 +1,7 @@
|
||||
# tests/integration/api/v1/platform/test_signup.py
|
||||
# tests/integration/api/v1/public/test_signup.py
|
||||
"""Integration tests for platform signup API endpoints.
|
||||
|
||||
Tests the /api/v1/platform/signup/* endpoints.
|
||||
Tests the /api/v1/public/signup/* endpoints.
|
||||
"""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
@@ -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.services.platform_signup_service.stripe_service") as mock:
|
||||
with patch("app.modules.marketplace.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",
|
||||
@@ -37,7 +37,7 @@ def mock_stripe_service():
|
||||
def signup_session(client):
|
||||
"""Create a signup session for testing."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.PROFESSIONAL.value, "is_annual": False},
|
||||
)
|
||||
return response.json()["session_id"]
|
||||
@@ -104,12 +104,12 @@ def claimed_letzshop_vendor(db, claimed_owner_user):
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestSignupStartAPI:
|
||||
"""Test signup start endpoint at /api/v1/platform/signup/start."""
|
||||
"""Test signup start endpoint at /api/v1/public/signup/start."""
|
||||
|
||||
def test_start_signup_success(self, client):
|
||||
"""Test starting a signup session."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.ESSENTIAL.value, "is_annual": False},
|
||||
)
|
||||
|
||||
@@ -122,7 +122,7 @@ class TestSignupStartAPI:
|
||||
def test_start_signup_with_annual_billing(self, client):
|
||||
"""Test starting signup with annual billing."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.PROFESSIONAL.value, "is_annual": True},
|
||||
)
|
||||
|
||||
@@ -134,7 +134,7 @@ class TestSignupStartAPI:
|
||||
"""Test starting signup for all valid tiers."""
|
||||
for tier in [TierCode.ESSENTIAL, TierCode.PROFESSIONAL, TierCode.BUSINESS, TierCode.ENTERPRISE]:
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": tier.value, "is_annual": False},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
@@ -143,7 +143,7 @@ class TestSignupStartAPI:
|
||||
def test_start_signup_invalid_tier(self, client):
|
||||
"""Test starting signup with invalid tier code."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": "invalid_tier", "is_annual": False},
|
||||
)
|
||||
|
||||
@@ -154,11 +154,11 @@ class TestSignupStartAPI:
|
||||
def test_start_signup_session_id_is_unique(self, client):
|
||||
"""Test that each signup session gets a unique ID."""
|
||||
response1 = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.ESSENTIAL.value, "is_annual": False},
|
||||
)
|
||||
response2 = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.ESSENTIAL.value, "is_annual": False},
|
||||
)
|
||||
|
||||
@@ -169,12 +169,12 @@ class TestSignupStartAPI:
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestClaimVendorAPI:
|
||||
"""Test claim vendor endpoint at /api/v1/platform/signup/claim-vendor."""
|
||||
"""Test claim vendor endpoint at /api/v1/public/signup/claim-vendor."""
|
||||
|
||||
def test_claim_vendor_success(self, client, signup_session):
|
||||
"""Test claiming a Letzshop vendor."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"letzshop_slug": "my-new-shop",
|
||||
@@ -190,7 +190,7 @@ class TestClaimVendorAPI:
|
||||
def test_claim_vendor_with_vendor_id(self, client, signup_session):
|
||||
"""Test claiming vendor with Letzshop vendor ID."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"letzshop_slug": "my-shop",
|
||||
@@ -205,7 +205,7 @@ class TestClaimVendorAPI:
|
||||
def test_claim_vendor_invalid_session(self, client):
|
||||
"""Test claiming vendor with invalid session."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": "invalid_session_id",
|
||||
"letzshop_slug": "my-shop",
|
||||
@@ -219,7 +219,7 @@ class TestClaimVendorAPI:
|
||||
def test_claim_vendor_already_claimed(self, client, signup_session, claimed_letzshop_vendor):
|
||||
"""Test claiming a vendor that's already claimed."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"letzshop_slug": "already-claimed-shop",
|
||||
@@ -235,12 +235,12 @@ class TestClaimVendorAPI:
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestCreateAccountAPI:
|
||||
"""Test create account endpoint at /api/v1/platform/signup/create-account."""
|
||||
"""Test create account endpoint at /api/v1/public/signup/create-account."""
|
||||
|
||||
def test_create_account_success(self, client, signup_session, mock_stripe_service):
|
||||
"""Test creating an account."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "newuser@example.com",
|
||||
@@ -261,7 +261,7 @@ class TestCreateAccountAPI:
|
||||
def test_create_account_with_phone(self, client, signup_session, mock_stripe_service):
|
||||
"""Test creating an account with phone number."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "user2@example.com",
|
||||
@@ -280,7 +280,7 @@ class TestCreateAccountAPI:
|
||||
def test_create_account_invalid_session(self, client, mock_stripe_service):
|
||||
"""Test creating account with invalid session."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": "invalid_session",
|
||||
"email": "test@example.com",
|
||||
@@ -298,7 +298,7 @@ class TestCreateAccountAPI:
|
||||
):
|
||||
"""Test creating account with existing email."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "existing@example.com",
|
||||
@@ -316,7 +316,7 @@ class TestCreateAccountAPI:
|
||||
def test_create_account_invalid_email(self, client, signup_session):
|
||||
"""Test creating account with invalid email format."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "not-an-email",
|
||||
@@ -333,14 +333,14 @@ class TestCreateAccountAPI:
|
||||
"""Test creating account after claiming Letzshop vendor."""
|
||||
# Start signup
|
||||
start_response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.PROFESSIONAL.value, "is_annual": False},
|
||||
)
|
||||
session_id = start_response.json()["session_id"]
|
||||
|
||||
# Claim vendor
|
||||
client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"letzshop_slug": "my-shop-claim",
|
||||
@@ -349,7 +349,7 @@ class TestCreateAccountAPI:
|
||||
|
||||
# Create account
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"email": "shop@example.com",
|
||||
@@ -369,13 +369,13 @@ class TestCreateAccountAPI:
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestSetupPaymentAPI:
|
||||
"""Test setup payment endpoint at /api/v1/platform/signup/setup-payment."""
|
||||
"""Test setup payment endpoint at /api/v1/public/signup/setup-payment."""
|
||||
|
||||
def test_setup_payment_success(self, client, signup_session, mock_stripe_service):
|
||||
"""Test setting up payment after account creation."""
|
||||
# Create account first
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "payment@example.com",
|
||||
@@ -388,7 +388,7 @@ class TestSetupPaymentAPI:
|
||||
|
||||
# Setup payment
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
@@ -401,7 +401,7 @@ class TestSetupPaymentAPI:
|
||||
def test_setup_payment_invalid_session(self, client, mock_stripe_service):
|
||||
"""Test setup payment with invalid session."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": "invalid_session"},
|
||||
)
|
||||
|
||||
@@ -410,7 +410,7 @@ class TestSetupPaymentAPI:
|
||||
def test_setup_payment_without_account(self, client, signup_session, mock_stripe_service):
|
||||
"""Test setup payment without creating account first."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
@@ -423,13 +423,13 @@ class TestSetupPaymentAPI:
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestCompleteSignupAPI:
|
||||
"""Test complete signup endpoint at /api/v1/platform/signup/complete."""
|
||||
"""Test complete signup endpoint at /api/v1/public/signup/complete."""
|
||||
|
||||
def test_complete_signup_success(self, client, signup_session, mock_stripe_service, db):
|
||||
"""Test completing signup after payment setup."""
|
||||
# Create account
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "complete@example.com",
|
||||
@@ -442,13 +442,13 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Setup payment
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
# Complete signup
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -469,7 +469,7 @@ class TestCompleteSignupAPI:
|
||||
"""Test that completing signup returns a valid JWT access token for auto-login."""
|
||||
# Create account
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "token_test@example.com",
|
||||
@@ -482,13 +482,13 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Setup payment
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
# Complete signup
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -509,7 +509,7 @@ class TestCompleteSignupAPI:
|
||||
"""Test that the returned access token can be used to authenticate API calls."""
|
||||
# Create account
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "auth_test@example.com",
|
||||
@@ -522,13 +522,13 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Setup payment
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
# Complete signup
|
||||
complete_response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -553,7 +553,7 @@ class TestCompleteSignupAPI:
|
||||
"""Test that completing signup sets the vendor_token HTTP-only cookie."""
|
||||
# Create account
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "cookie_test@example.com",
|
||||
@@ -566,13 +566,13 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Setup payment
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
# Complete signup
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -588,7 +588,7 @@ class TestCompleteSignupAPI:
|
||||
def test_complete_signup_invalid_session(self, client, mock_stripe_service):
|
||||
"""Test completing signup with invalid session."""
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": "invalid_session",
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -603,7 +603,7 @@ class TestCompleteSignupAPI:
|
||||
"""Test completing signup when payment setup failed."""
|
||||
# Create account
|
||||
client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"email": "fail@example.com",
|
||||
@@ -616,7 +616,7 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Setup payment
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": signup_session},
|
||||
)
|
||||
|
||||
@@ -629,7 +629,7 @@ class TestCompleteSignupAPI:
|
||||
|
||||
# Complete signup
|
||||
response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"setup_intent_id": "seti_failed",
|
||||
@@ -645,11 +645,11 @@ class TestCompleteSignupAPI:
|
||||
@pytest.mark.api
|
||||
@pytest.mark.platform
|
||||
class TestGetSignupSessionAPI:
|
||||
"""Test get signup session endpoint at /api/v1/platform/signup/session/{session_id}."""
|
||||
"""Test get signup session endpoint at /api/v1/public/signup/session/{session_id}."""
|
||||
|
||||
def test_get_session_after_start(self, client, signup_session):
|
||||
"""Test getting session after starting signup."""
|
||||
response = client.get(f"/api/v1/platform/signup/session/{signup_session}")
|
||||
response = client.get(f"/api/v1/public/signup/session/{signup_session}")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -661,14 +661,14 @@ class TestGetSignupSessionAPI:
|
||||
def test_get_session_after_claim(self, client, signup_session):
|
||||
"""Test getting session after claiming vendor."""
|
||||
client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": signup_session,
|
||||
"letzshop_slug": "my-session-shop",
|
||||
},
|
||||
)
|
||||
|
||||
response = client.get(f"/api/v1/platform/signup/session/{signup_session}")
|
||||
response = client.get(f"/api/v1/public/signup/session/{signup_session}")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -677,7 +677,7 @@ class TestGetSignupSessionAPI:
|
||||
|
||||
def test_get_session_invalid_id(self, client):
|
||||
"""Test getting non-existent session."""
|
||||
response = client.get("/api/v1/platform/signup/session/invalid_id")
|
||||
response = client.get("/api/v1/public/signup/session/invalid_id")
|
||||
|
||||
assert response.status_code == 404
|
||||
|
||||
@@ -692,7 +692,7 @@ class TestSignupFullFlow:
|
||||
"""Test the complete signup flow from start to finish."""
|
||||
# Step 1: Start signup
|
||||
start_response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.BUSINESS.value, "is_annual": True},
|
||||
)
|
||||
assert start_response.status_code == 200
|
||||
@@ -700,7 +700,7 @@ class TestSignupFullFlow:
|
||||
|
||||
# Step 2: Claim Letzshop vendor (optional)
|
||||
claim_response = client.post(
|
||||
"/api/v1/platform/signup/claim-vendor",
|
||||
"/api/v1/public/signup/claim-vendor",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"letzshop_slug": "full-flow-shop",
|
||||
@@ -710,7 +710,7 @@ class TestSignupFullFlow:
|
||||
|
||||
# Step 3: Create account
|
||||
account_response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"email": "fullflow@example.com",
|
||||
@@ -726,7 +726,7 @@ class TestSignupFullFlow:
|
||||
|
||||
# Step 4: Setup payment
|
||||
payment_response = client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": session_id},
|
||||
)
|
||||
assert payment_response.status_code == 200
|
||||
@@ -734,7 +734,7 @@ class TestSignupFullFlow:
|
||||
|
||||
# Step 5: Complete signup
|
||||
complete_response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
@@ -753,14 +753,14 @@ class TestSignupFullFlow:
|
||||
"""Test signup flow skipping Letzshop claim step."""
|
||||
# Step 1: Start signup
|
||||
start_response = client.post(
|
||||
"/api/v1/platform/signup/start",
|
||||
"/api/v1/public/signup/start",
|
||||
json={"tier_code": TierCode.ESSENTIAL.value, "is_annual": False},
|
||||
)
|
||||
session_id = start_response.json()["session_id"]
|
||||
|
||||
# Skip Step 2, go directly to Step 3
|
||||
account_response = client.post(
|
||||
"/api/v1/platform/signup/create-account",
|
||||
"/api/v1/public/signup/create-account",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"email": "noletzshop@example.com",
|
||||
@@ -775,12 +775,12 @@ class TestSignupFullFlow:
|
||||
|
||||
# Step 4 & 5: Payment and complete
|
||||
client.post(
|
||||
"/api/v1/platform/signup/setup-payment",
|
||||
"/api/v1/public/signup/setup-payment",
|
||||
json={"session_id": session_id},
|
||||
)
|
||||
|
||||
complete_response = client.post(
|
||||
"/api/v1/platform/signup/complete",
|
||||
"/api/v1/public/signup/complete",
|
||||
json={
|
||||
"session_id": session_id,
|
||||
"setup_intent_id": "seti_test_123",
|
||||
10
tests/integration/api/v1/vendor/test_letzshop.py
vendored
10
tests/integration/api/v1/vendor/test_letzshop.py
vendored
@@ -165,7 +165,7 @@ class TestVendorLetzshopConnectionAPI:
|
||||
assert data["success"] is False
|
||||
assert "not configured" in data["error_details"]
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_test_connection_success(
|
||||
self, mock_post, client, vendor_user_headers, test_vendor_with_vendor_user
|
||||
):
|
||||
@@ -193,7 +193,7 @@ class TestVendorLetzshopConnectionAPI:
|
||||
assert data["success"] is True
|
||||
assert data["response_time_ms"] is not None
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_test_api_key_without_saving(
|
||||
self, mock_post, client, vendor_user_headers, test_vendor_with_vendor_user
|
||||
):
|
||||
@@ -382,7 +382,7 @@ class TestVendorLetzshopOrdersAPI:
|
||||
|
||||
assert response.status_code == 422 # Validation error
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_import_orders_success(
|
||||
self,
|
||||
mock_post,
|
||||
@@ -445,7 +445,7 @@ class TestVendorLetzshopOrdersAPI:
|
||||
class TestVendorLetzshopFulfillmentAPI:
|
||||
"""Test vendor Letzshop fulfillment endpoints."""
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_confirm_order(
|
||||
self,
|
||||
mock_post,
|
||||
@@ -534,7 +534,7 @@ class TestVendorLetzshopFulfillmentAPI:
|
||||
data = response.json()
|
||||
assert data["success"] is True
|
||||
|
||||
@patch("app.services.letzshop.client_service.requests.Session.post")
|
||||
@patch("app.modules.marketplace.services.letzshop.client_service.requests.Session.post")
|
||||
def test_set_tracking(
|
||||
self,
|
||||
mock_post,
|
||||
|
||||
@@ -3,7 +3,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.tasks.background_tasks import process_marketplace_import
|
||||
from app.modules.marketplace.tasks import process_marketplace_import
|
||||
from app.modules.marketplace.models import MarketplaceImportJob
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.letzshop import LetzshopClientError
|
||||
from app.tasks.letzshop_tasks import process_historical_import
|
||||
from app.modules.marketplace.services.letzshop import LetzshopClientError
|
||||
from app.modules.marketplace.tasks import process_historical_import
|
||||
from app.modules.marketplace.models import LetzshopHistoricalImportJob
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from unittest.mock import MagicMock, PropertyMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.tasks.subscription_tasks import (
|
||||
from app.modules.billing.tasks import (
|
||||
check_trial_expirations,
|
||||
cleanup_stale_subscriptions,
|
||||
reset_period_counters,
|
||||
|
||||
@@ -19,7 +19,7 @@ import pytest
|
||||
from fastapi import HTTPException
|
||||
from jose import jwt
|
||||
|
||||
from app.exceptions import (
|
||||
from app.modules.tenancy.exceptions import (
|
||||
AdminRequiredException,
|
||||
InsufficientPermissionsException,
|
||||
InvalidCredentialsException,
|
||||
|
||||
@@ -17,7 +17,7 @@ import pytest
|
||||
from fastapi import Request
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.exceptions.vendor import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
from middleware.vendor_context import (
|
||||
VendorContextManager,
|
||||
VendorContextMiddleware,
|
||||
|
||||
@@ -7,8 +7,8 @@ from decimal import Decimal
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions.customer import CustomerNotFoundException
|
||||
from app.services.admin_customer_service import AdminCustomerService
|
||||
from app.modules.customers.exceptions import CustomerNotFoundException
|
||||
from app.modules.customers.services.admin_customer_service import AdminCustomerService
|
||||
from app.modules.customers.models.customer import Customer
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.admin_notification_service import (
|
||||
from app.modules.messaging.services.admin_notification_service import (
|
||||
AdminNotificationService,
|
||||
AlertType,
|
||||
NotificationType,
|
||||
|
||||
@@ -7,8 +7,9 @@ Tests the admin platform assignment service operations.
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import AdminOperationException, CannotModifySelfException, ValidationException
|
||||
from app.services.admin_platform_service import AdminPlatformService
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.tenancy.exceptions import AdminOperationException, CannotModifySelfException
|
||||
from app.modules.tenancy.services.admin_platform_service import AdminPlatformService
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# tests/unit/services/test_admin_service.py
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.tenancy.exceptions import (
|
||||
AdminOperationException,
|
||||
CannotModifySelfException,
|
||||
UserNotFoundException,
|
||||
UserStatusChangeException,
|
||||
ValidationException,
|
||||
VendorAlreadyExistsException,
|
||||
VendorNotFoundException,
|
||||
)
|
||||
from app.services.admin_service import AdminService
|
||||
from app.services.stats_service import stats_service
|
||||
from app.modules.tenancy.services.admin_service import AdminService
|
||||
from app.modules.analytics.services.stats_service import stats_service
|
||||
from models.schema.vendor import VendorCreate
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions.auth import (
|
||||
from app.modules.tenancy.exceptions import (
|
||||
InvalidCredentialsException,
|
||||
UserNotActiveException,
|
||||
)
|
||||
from app.services.auth_service import AuthService
|
||||
from app.modules.core.services.auth_service import AuthService
|
||||
from models.schema.auth import UserLogin
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.services.billing_service import (
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
from app.modules.billing.services.billing_service import (
|
||||
BillingService,
|
||||
NoActiveSubscriptionError,
|
||||
PaymentSystemNotConfiguredError,
|
||||
@@ -107,7 +107,7 @@ class TestBillingServiceCheckout:
|
||||
"""Initialize service instance before each test."""
|
||||
self.service = BillingService()
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_checkout_session_stripe_not_configured(
|
||||
self, mock_stripe, db, test_vendor, test_subscription_tier
|
||||
):
|
||||
@@ -124,7 +124,7 @@ class TestBillingServiceCheckout:
|
||||
cancel_url="https://example.com/cancel",
|
||||
)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_checkout_session_success(
|
||||
self, mock_stripe, db, test_vendor, test_subscription_tier_with_stripe
|
||||
):
|
||||
@@ -147,7 +147,7 @@ class TestBillingServiceCheckout:
|
||||
assert result["checkout_url"] == "https://checkout.stripe.com/test"
|
||||
assert result["session_id"] == "cs_test_123"
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_checkout_session_tier_not_found(
|
||||
self, mock_stripe, db, test_vendor
|
||||
):
|
||||
@@ -164,7 +164,7 @@ class TestBillingServiceCheckout:
|
||||
cancel_url="https://example.com/cancel",
|
||||
)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_checkout_session_no_price(
|
||||
self, mock_stripe, db, test_vendor, test_subscription_tier
|
||||
):
|
||||
@@ -191,7 +191,7 @@ class TestBillingServicePortal:
|
||||
"""Initialize service instance before each test."""
|
||||
self.service = BillingService()
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_portal_session_stripe_not_configured(self, mock_stripe, db, test_vendor):
|
||||
"""Test portal fails when Stripe not configured."""
|
||||
mock_stripe.is_configured = False
|
||||
@@ -203,7 +203,7 @@ class TestBillingServicePortal:
|
||||
return_url="https://example.com/billing",
|
||||
)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_portal_session_no_subscription(self, mock_stripe, db, test_vendor):
|
||||
"""Test portal fails when no subscription exists."""
|
||||
mock_stripe.is_configured = True
|
||||
@@ -215,7 +215,7 @@ class TestBillingServicePortal:
|
||||
return_url="https://example.com/billing",
|
||||
)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_create_portal_session_success(
|
||||
self, mock_stripe, db, test_vendor, test_active_subscription
|
||||
):
|
||||
@@ -313,7 +313,7 @@ class TestBillingServiceCancellation:
|
||||
"""Initialize service instance before each test."""
|
||||
self.service = BillingService()
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_cancel_subscription_no_subscription(
|
||||
self, mock_stripe, db, test_vendor
|
||||
):
|
||||
@@ -328,7 +328,7 @@ class TestBillingServiceCancellation:
|
||||
immediately=False,
|
||||
)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_cancel_subscription_success(
|
||||
self, mock_stripe, db, test_vendor, test_active_subscription
|
||||
):
|
||||
@@ -346,7 +346,7 @@ class TestBillingServiceCancellation:
|
||||
assert test_active_subscription.cancelled_at is not None
|
||||
assert test_active_subscription.cancellation_reason == "Too expensive"
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_reactivate_subscription_not_cancelled(
|
||||
self, mock_stripe, db, test_vendor, test_active_subscription
|
||||
):
|
||||
@@ -356,7 +356,7 @@ class TestBillingServiceCancellation:
|
||||
with pytest.raises(SubscriptionNotCancelledError):
|
||||
self.service.reactivate_subscription(db, test_vendor.id)
|
||||
|
||||
@patch("app.services.billing_service.stripe_service")
|
||||
@patch("app.modules.billing.services.billing_service.stripe_service")
|
||||
def test_reactivate_subscription_success(
|
||||
self, mock_stripe, db, test_vendor, test_cancelled_subscription
|
||||
):
|
||||
|
||||
@@ -15,7 +15,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.capacity_forecast_service import (
|
||||
from app.modules.billing.services.capacity_forecast_service import (
|
||||
INFRASTRUCTURE_SCALING,
|
||||
CapacityForecastService,
|
||||
capacity_forecast_service,
|
||||
|
||||
@@ -5,8 +5,8 @@ Unit tests for CustomerAddressService.
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import AddressLimitExceededException, AddressNotFoundException
|
||||
from app.services.customer_address_service import CustomerAddressService
|
||||
from app.modules.customers.exceptions import AddressLimitExceededException, AddressNotFoundException
|
||||
from app.modules.customers.services.customer_address_service import CustomerAddressService
|
||||
from app.modules.customers.models.customer import CustomerAddress
|
||||
from app.modules.customers.schemas import CustomerAddressCreate, CustomerAddressUpdate
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.email_service import (
|
||||
from app.modules.messaging.services.email_service import (
|
||||
DebugProvider,
|
||||
EmailProvider,
|
||||
EmailService,
|
||||
@@ -56,7 +56,7 @@ class TestEmailProviders:
|
||||
|
||||
assert success is True
|
||||
|
||||
@patch("app.services.email_service.settings")
|
||||
@patch("app.modules.messaging.services.email_service.settings")
|
||||
def test_get_provider_debug_mode(self, mock_settings):
|
||||
"""Test get_provider returns DebugProvider in debug mode."""
|
||||
mock_settings.email_debug = True
|
||||
@@ -65,7 +65,7 @@ class TestEmailProviders:
|
||||
|
||||
assert isinstance(provider, DebugProvider)
|
||||
|
||||
@patch("app.services.email_service.settings")
|
||||
@patch("app.modules.messaging.services.email_service.settings")
|
||||
def test_get_provider_smtp(self, mock_settings):
|
||||
"""Test get_provider returns SMTPProvider for smtp config."""
|
||||
mock_settings.email_debug = False
|
||||
@@ -75,7 +75,7 @@ class TestEmailProviders:
|
||||
|
||||
assert isinstance(provider, SMTPProvider)
|
||||
|
||||
@patch("app.services.email_service.settings")
|
||||
@patch("app.modules.messaging.services.email_service.settings")
|
||||
def test_get_provider_unknown_defaults_to_smtp(self, mock_settings):
|
||||
"""Test get_provider defaults to SMTP for unknown providers."""
|
||||
mock_settings.email_debug = False
|
||||
@@ -211,8 +211,8 @@ class TestEmailService:
|
||||
class TestEmailSending:
|
||||
"""Test suite for email sending functionality."""
|
||||
|
||||
@patch("app.services.email_service.get_platform_provider")
|
||||
@patch("app.services.email_service.get_platform_email_config")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_provider")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_email_config")
|
||||
def test_send_raw_success(self, mock_get_config, mock_get_platform_provider, db):
|
||||
"""Test successful raw email sending."""
|
||||
# Setup mocks
|
||||
@@ -243,8 +243,8 @@ class TestEmailSending:
|
||||
assert log.subject == "Test Subject"
|
||||
assert log.provider_message_id == "msg-123"
|
||||
|
||||
@patch("app.services.email_service.get_platform_provider")
|
||||
@patch("app.services.email_service.get_platform_email_config")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_provider")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_email_config")
|
||||
def test_send_raw_failure(self, mock_get_config, mock_get_platform_provider, db):
|
||||
"""Test failed raw email sending."""
|
||||
# Setup mocks
|
||||
@@ -272,7 +272,7 @@ class TestEmailSending:
|
||||
assert log.status == EmailStatus.FAILED.value
|
||||
assert log.error_message == "Connection refused"
|
||||
|
||||
@patch("app.services.email_service.settings")
|
||||
@patch("app.modules.messaging.services.email_service.settings")
|
||||
def test_send_raw_email_disabled(self, mock_settings, db):
|
||||
"""Test email sending when disabled."""
|
||||
mock_settings.email_enabled = False
|
||||
@@ -293,8 +293,8 @@ class TestEmailSending:
|
||||
assert log.status == EmailStatus.FAILED.value
|
||||
assert "disabled" in log.error_message.lower()
|
||||
|
||||
@patch("app.services.email_service.get_platform_provider")
|
||||
@patch("app.services.email_service.get_platform_email_config")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_provider")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_email_config")
|
||||
def test_send_template_success(self, mock_get_config, mock_get_platform_provider, db):
|
||||
"""Test successful template email sending."""
|
||||
# Create test template
|
||||
@@ -586,8 +586,8 @@ class TestSignupWelcomeEmail:
|
||||
for var in required_vars:
|
||||
assert var in template.variables_list, f"Missing variable: {var}"
|
||||
|
||||
@patch("app.services.email_service.get_platform_provider")
|
||||
@patch("app.services.email_service.get_platform_email_config")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_provider")
|
||||
@patch("app.modules.messaging.services.email_service.get_platform_email_config")
|
||||
def test_welcome_email_send(self, mock_get_config, mock_get_platform_provider, db, welcome_template, test_vendor, test_user):
|
||||
"""Test sending welcome email."""
|
||||
# Setup mocks
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import FeatureNotFoundError, InvalidFeatureCodesError, TierNotFoundError
|
||||
from app.services.feature_service import FeatureService, feature_service
|
||||
from app.modules.billing.exceptions import FeatureNotFoundError, InvalidFeatureCodesError, TierNotFoundError
|
||||
from app.modules.billing.services.feature_service import FeatureService, feature_service
|
||||
from app.modules.billing.models import Feature
|
||||
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.modules.inventory.exceptions import (
|
||||
InsufficientInventoryException,
|
||||
InvalidQuantityException,
|
||||
InventoryNotFoundException,
|
||||
InventoryValidationException,
|
||||
ProductNotFoundException,
|
||||
)
|
||||
from app.services.inventory_service import InventoryService
|
||||
from app.modules.catalog.exceptions import ProductNotFoundException
|
||||
from app.modules.inventory.services.inventory_service import InventoryService
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.inventory.schemas import (
|
||||
InventoryAdjust,
|
||||
@@ -126,7 +126,7 @@ class TestInventoryService:
|
||||
|
||||
def test_set_inventory_product_not_found(self, db, test_vendor):
|
||||
"""Test setting inventory for non-existent product raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
unique_id = str(uuid.uuid4())[:8].upper()
|
||||
inventory_data = InventoryCreate(
|
||||
@@ -203,7 +203,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test removing more than available raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
inventory_data = InventoryAdjust(
|
||||
product_id=test_product.id,
|
||||
@@ -251,7 +251,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test reserving more than available raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
available = test_inventory.quantity - test_inventory.reserved_quantity
|
||||
|
||||
@@ -335,7 +335,7 @@ class TestInventoryService:
|
||||
self, db, test_inventory, test_product, test_vendor
|
||||
):
|
||||
"""Test fulfilling more than quantity raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
reserve_data = InventoryReserve(
|
||||
product_id=test_product.id,
|
||||
@@ -401,7 +401,7 @@ class TestInventoryService:
|
||||
|
||||
def test_get_product_inventory_not_found(self, db, test_vendor):
|
||||
"""Test getting inventory for non-existent product raises exception."""
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions import ValidationException
|
||||
|
||||
# Service wraps ProductNotFoundException in ValidationException
|
||||
with pytest.raises((ProductNotFoundException, ValidationException)):
|
||||
@@ -675,7 +675,7 @@ class TestInventoryService:
|
||||
|
||||
def test_get_vendor_inventory_admin_vendor_not_found(self, db):
|
||||
"""Test get_vendor_inventory_admin raises for non-existent vendor."""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.get_vendor_inventory_admin(db, vendor_id=99999)
|
||||
@@ -700,7 +700,7 @@ class TestInventoryService:
|
||||
|
||||
def test_verify_vendor_exists_not_found(self, db):
|
||||
"""Test verify_vendor_exists raises for non-existent vendor."""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.verify_vendor_exists(db, 99999)
|
||||
|
||||
@@ -7,11 +7,11 @@ from decimal import Decimal
|
||||
import pytest
|
||||
|
||||
from app.exceptions import ValidationException
|
||||
from app.exceptions.invoice import (
|
||||
from app.modules.orders.exceptions import (
|
||||
InvoiceNotFoundException,
|
||||
InvoiceSettingsNotFoundException,
|
||||
)
|
||||
from app.services.invoice_service import (
|
||||
from app.modules.orders.services.invoice_service import (
|
||||
EU_VAT_RATES,
|
||||
InvoiceService,
|
||||
LU_VAT_RATES,
|
||||
|
||||
@@ -12,7 +12,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.letzshop import (
|
||||
from app.modules.marketplace.services.letzshop import (
|
||||
CredentialsNotFoundError,
|
||||
LetzshopAPIError,
|
||||
LetzshopClient,
|
||||
@@ -570,7 +570,7 @@ class TestLetzshopOrderService:
|
||||
|
||||
def test_create_order_extracts_locale(self, db, test_vendor):
|
||||
"""Test that create_order extracts customer locale."""
|
||||
from app.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
|
||||
service = LetzshopOrderService(db)
|
||||
|
||||
@@ -603,7 +603,7 @@ class TestLetzshopOrderService:
|
||||
|
||||
def test_create_order_extracts_ean(self, db, test_vendor):
|
||||
"""Test that create_order extracts EAN from tradeId."""
|
||||
from app.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
|
||||
service = LetzshopOrderService(db)
|
||||
|
||||
@@ -652,7 +652,7 @@ class TestLetzshopOrderService:
|
||||
|
||||
def test_import_historical_shipments_deduplication(self, db, test_vendor):
|
||||
"""Test that historical import deduplicates existing orders."""
|
||||
from app.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
|
||||
service = LetzshopOrderService(db)
|
||||
|
||||
@@ -686,7 +686,7 @@ class TestLetzshopOrderService:
|
||||
|
||||
def test_import_historical_shipments_new_orders(self, db, test_vendor):
|
||||
"""Test that historical import creates new orders."""
|
||||
from app.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
|
||||
service = LetzshopOrderService(db)
|
||||
|
||||
@@ -718,7 +718,7 @@ class TestLetzshopOrderService:
|
||||
|
||||
def test_get_historical_import_summary(self, db, test_vendor):
|
||||
"""Test historical import summary statistics."""
|
||||
from app.services.letzshop.order_service import LetzshopOrderService
|
||||
from app.modules.marketplace.services.letzshop.order_service import LetzshopOrderService
|
||||
|
||||
service = LetzshopOrderService(db)
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
InvalidMarketplaceProductDataException,
|
||||
MarketplaceProductNotFoundException,
|
||||
MarketplaceProductValidationException,
|
||||
ValidationException,
|
||||
)
|
||||
from app.services.marketplace_product_service import (
|
||||
from app.modules.marketplace.services.marketplace_product_service import (
|
||||
MarketplaceProductService,
|
||||
marketplace_product_service,
|
||||
)
|
||||
@@ -502,7 +502,7 @@ class TestMarketplaceProductServiceCopyToCatalog:
|
||||
mock_subscription.products_limit = 100
|
||||
|
||||
with patch(
|
||||
"app.services.subscription_service.subscription_service"
|
||||
"app.modules.billing.services.subscription_service.subscription_service"
|
||||
) as mock_sub:
|
||||
mock_sub.get_or_create_subscription.return_value = mock_subscription
|
||||
|
||||
@@ -519,7 +519,7 @@ class TestMarketplaceProductServiceCopyToCatalog:
|
||||
|
||||
def test_copy_to_vendor_catalog_vendor_not_found(self, db, test_marketplace_product):
|
||||
"""Test copy fails for non-existent vendor"""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.copy_to_vendor_catalog(
|
||||
|
||||
@@ -5,13 +5,13 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions.base import ValidationException
|
||||
from app.exceptions.marketplace_import_job import (
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.marketplace.exceptions import (
|
||||
ImportJobNotFoundException,
|
||||
ImportJobNotOwnedException,
|
||||
)
|
||||
from app.exceptions.vendor import UnauthorizedVendorAccessException
|
||||
from app.services.marketplace_import_job_service import MarketplaceImportJobService
|
||||
from app.modules.tenancy.exceptions import UnauthorizedVendorAccessException
|
||||
from app.modules.marketplace.services.marketplace_import_job_service import MarketplaceImportJobService
|
||||
from app.modules.marketplace.models import MarketplaceImportJob
|
||||
from app.modules.marketplace.schemas import MarketplaceImportJobRequest
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
import pytest
|
||||
from fastapi import UploadFile
|
||||
|
||||
from app.services.message_attachment_service import (
|
||||
from app.modules.messaging.services.message_attachment_service import (
|
||||
ALLOWED_MIME_TYPES,
|
||||
DEFAULT_MAX_FILE_SIZE_MB,
|
||||
IMAGE_MIME_TYPES,
|
||||
@@ -101,7 +101,7 @@ class TestMessageAttachmentServiceMaxFileSize:
|
||||
def test_get_max_file_size_from_settings(self, db, attachment_service):
|
||||
"""Test retrieving max file size from platform settings."""
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 15
|
||||
max_size = attachment_service.get_max_file_size_bytes(db)
|
||||
@@ -110,7 +110,7 @@ class TestMessageAttachmentServiceMaxFileSize:
|
||||
def test_get_max_file_size_default(self, db, attachment_service):
|
||||
"""Test default max file size when setting not found."""
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = DEFAULT_MAX_FILE_SIZE_MB
|
||||
max_size = attachment_service.get_max_file_size_bytes(db)
|
||||
@@ -119,7 +119,7 @@ class TestMessageAttachmentServiceMaxFileSize:
|
||||
def test_get_max_file_size_invalid_value(self, db, attachment_service):
|
||||
"""Test handling of invalid setting value."""
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = "invalid"
|
||||
max_size = attachment_service.get_max_file_size_bytes(db)
|
||||
@@ -142,7 +142,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10
|
||||
|
||||
@@ -181,7 +181,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10
|
||||
|
||||
@@ -208,7 +208,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10
|
||||
|
||||
@@ -233,7 +233,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
)
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10 # 10 MB limit
|
||||
|
||||
@@ -257,7 +257,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
file.filename = None # Ensure it's None
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10
|
||||
|
||||
@@ -282,7 +282,7 @@ class TestMessageAttachmentServiceValidateAndStore:
|
||||
file.content_type = None
|
||||
|
||||
with patch(
|
||||
"app.services.message_attachment_service.admin_settings_service"
|
||||
"app.modules.messaging.services.message_attachment_service.admin_settings_service"
|
||||
) as mock_settings:
|
||||
mock_settings.get_setting_value.return_value = 10
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.messaging_service import MessagingService
|
||||
from app.modules.messaging.services.messaging_service import MessagingService
|
||||
from app.modules.messaging.models import (
|
||||
Conversation,
|
||||
ConversationParticipant,
|
||||
|
||||
@@ -15,7 +15,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.onboarding_service import OnboardingService
|
||||
from app.modules.marketplace.services.onboarding_service import OnboardingService
|
||||
from app.modules.marketplace.models import OnboardingStatus, OnboardingStep, VendorOnboarding
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestOnboardingServiceCRUD:
|
||||
|
||||
def test_get_onboarding_or_raise_raises_exception(self, db):
|
||||
"""Test get_onboarding_or_raise raises OnboardingNotFoundException"""
|
||||
from app.exceptions import OnboardingNotFoundException
|
||||
from app.modules.marketplace.exceptions import OnboardingNotFoundException
|
||||
|
||||
service = OnboardingService(db)
|
||||
with pytest.raises(OnboardingNotFoundException):
|
||||
@@ -214,7 +214,7 @@ class TestOnboardingServiceStep1:
|
||||
|
||||
def test_complete_company_profile_raises_for_missing_vendor(self, db):
|
||||
"""Test complete_company_profile raises for non-existent vendor"""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
service = OnboardingService(db)
|
||||
|
||||
@@ -238,7 +238,7 @@ class TestOnboardingServiceStep2:
|
||||
def test_test_letzshop_api_returns_result(self, db, test_vendor):
|
||||
"""Test test_letzshop_api returns connection test result"""
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopCredentialsService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopCredentialsService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_instance.test_api_key.return_value = (True, 150.0, None)
|
||||
@@ -256,7 +256,7 @@ class TestOnboardingServiceStep2:
|
||||
def test_test_letzshop_api_returns_error(self, db, test_vendor):
|
||||
"""Test test_letzshop_api returns error on failure"""
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopCredentialsService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopCredentialsService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_instance.test_api_key.return_value = (False, None, "Invalid API key")
|
||||
@@ -273,7 +273,7 @@ class TestOnboardingServiceStep2:
|
||||
|
||||
def test_complete_letzshop_api_requires_step1(self, db, test_vendor):
|
||||
"""Test complete_letzshop_api requires step 1 complete"""
|
||||
from app.exceptions import OnboardingStepOrderException
|
||||
from app.modules.marketplace.exceptions import OnboardingStepOrderException
|
||||
|
||||
# Create onboarding with step 1 not complete
|
||||
onboarding = VendorOnboarding(
|
||||
@@ -319,7 +319,7 @@ class TestOnboardingServiceStep3:
|
||||
|
||||
def test_complete_product_import_requires_csv_url(self, db, test_vendor):
|
||||
"""Test complete_product_import requires at least one CSV URL"""
|
||||
from app.exceptions import OnboardingCsvUrlRequiredException
|
||||
from app.modules.marketplace.exceptions import OnboardingCsvUrlRequiredException
|
||||
|
||||
# Create onboarding with steps 1 and 2 complete
|
||||
onboarding = VendorOnboarding(
|
||||
@@ -391,7 +391,7 @@ class TestOnboardingServiceStep4:
|
||||
db.commit()
|
||||
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_instance.get_running_historical_import_job.return_value = None
|
||||
@@ -425,7 +425,7 @@ class TestOnboardingServiceStep4:
|
||||
db.commit()
|
||||
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
existing_job = MagicMock()
|
||||
@@ -446,7 +446,7 @@ class TestOnboardingServiceStep4:
|
||||
def test_get_order_sync_progress_not_found(self, db, test_vendor):
|
||||
"""Test get_order_sync_progress for non-existent job"""
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_instance.get_historical_import_job_by_id.return_value = None
|
||||
@@ -464,7 +464,7 @@ class TestOnboardingServiceStep4:
|
||||
def test_get_order_sync_progress_completed(self, db, test_vendor):
|
||||
"""Test get_order_sync_progress for completed job"""
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_job = MagicMock()
|
||||
@@ -494,7 +494,7 @@ class TestOnboardingServiceStep4:
|
||||
def test_get_order_sync_progress_processing(self, db, test_vendor):
|
||||
"""Test get_order_sync_progress for processing job"""
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_job = MagicMock()
|
||||
@@ -525,7 +525,7 @@ class TestOnboardingServiceStep4:
|
||||
|
||||
def test_complete_order_sync_raises_for_missing_job(self, db, test_vendor):
|
||||
"""Test complete_order_sync raises for non-existent job"""
|
||||
from app.exceptions import OnboardingSyncJobNotFoundException
|
||||
from app.modules.marketplace.exceptions import OnboardingSyncJobNotFoundException
|
||||
|
||||
onboarding = VendorOnboarding(
|
||||
vendor_id=test_vendor.id,
|
||||
@@ -535,7 +535,7 @@ class TestOnboardingServiceStep4:
|
||||
db.commit()
|
||||
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_instance.get_historical_import_job_by_id.return_value = None
|
||||
@@ -550,7 +550,7 @@ class TestOnboardingServiceStep4:
|
||||
|
||||
def test_complete_order_sync_raises_if_not_complete(self, db, test_vendor):
|
||||
"""Test complete_order_sync raises if job still running"""
|
||||
from app.exceptions import OnboardingSyncNotCompleteException
|
||||
from app.modules.marketplace.exceptions import OnboardingSyncNotCompleteException
|
||||
|
||||
onboarding = VendorOnboarding(
|
||||
vendor_id=test_vendor.id,
|
||||
@@ -560,7 +560,7 @@ class TestOnboardingServiceStep4:
|
||||
db.commit()
|
||||
|
||||
with patch(
|
||||
"app.services.onboarding_service.LetzshopOrderService"
|
||||
"app.modules.marketplace.services.onboarding_service.LetzshopOrderService"
|
||||
) as mock_service:
|
||||
mock_instance = MagicMock()
|
||||
mock_job = MagicMock()
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.modules.orders.exceptions import (
|
||||
ExceptionAlreadyResolvedException,
|
||||
InvalidProductForExceptionException,
|
||||
OrderItemExceptionNotFoundException,
|
||||
ProductNotFoundException,
|
||||
)
|
||||
from app.services.order_item_exception_service import OrderItemExceptionService
|
||||
from app.modules.catalog.exceptions import ProductNotFoundException
|
||||
from app.modules.orders.services.order_item_exception_service import OrderItemExceptionService
|
||||
from app.modules.orders.models import OrderItem
|
||||
from app.modules.orders.models import OrderItemException
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
CustomerNotFoundException,
|
||||
OrderNotFoundException,
|
||||
ValidationException,
|
||||
)
|
||||
from app.services.order_service import (
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.customers.exceptions import CustomerNotFoundException
|
||||
from app.modules.orders.exceptions import OrderNotFoundException
|
||||
from app.modules.orders.services.order_service import (
|
||||
PLACEHOLDER_GTIN,
|
||||
PLACEHOLDER_MARKETPLACE_ID,
|
||||
OrderService,
|
||||
@@ -518,7 +516,7 @@ class TestOrderServiceLetzshop:
|
||||
}
|
||||
|
||||
with patch(
|
||||
"app.services.order_service.subscription_service"
|
||||
"app.modules.orders.services.order_service.subscription_service"
|
||||
) as mock_sub:
|
||||
mock_sub.can_create_order.return_value = (True, None)
|
||||
mock_sub.increment_order_count.return_value = None
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# tests/test_product_service.py
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.modules.marketplace.exceptions import (
|
||||
InvalidMarketplaceProductDataException,
|
||||
MarketplaceProductAlreadyExistsException,
|
||||
MarketplaceProductNotFoundException,
|
||||
MarketplaceProductValidationException,
|
||||
)
|
||||
from app.services.marketplace_product_service import MarketplaceProductService
|
||||
from app.modules.marketplace.services.marketplace_product_service import MarketplaceProductService
|
||||
from app.modules.marketplace.schemas import (
|
||||
MarketplaceProductCreate,
|
||||
MarketplaceProductUpdate,
|
||||
@@ -488,7 +488,7 @@ class TestMarketplaceProductServiceAdmin:
|
||||
|
||||
def test_copy_to_vendor_catalog_invalid_vendor(self, db, test_marketplace_product):
|
||||
"""Test copying to non-existent vendor raises exception."""
|
||||
from app.exceptions import VendorNotFoundException
|
||||
from app.modules.tenancy.exceptions import VendorNotFoundException
|
||||
|
||||
with pytest.raises(VendorNotFoundException):
|
||||
self.service.copy_to_vendor_catalog(
|
||||
|
||||
@@ -7,8 +7,8 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from app.exceptions import AdminOperationException, VendorNotFoundException
|
||||
from app.services.stats_service import StatsService
|
||||
from app.modules.tenancy.exceptions import AdminOperationException, VendorNotFoundException
|
||||
from app.modules.analytics.services.stats_service import StatsService
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.marketplace.models import (
|
||||
MarketplaceProduct,
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import MagicMock
|
||||
import pytest
|
||||
|
||||
from app.exceptions import ValidationException
|
||||
from app.services.team_service import TeamService, team_service
|
||||
from app.modules.tenancy.services.team_service import TeamService, team_service
|
||||
from models.database.vendor import Role, VendorUser
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.usage_service import UsageService, usage_service
|
||||
from app.modules.analytics.services.usage_service import UsageService, usage_service
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.billing.models import SubscriptionTier, VendorSubscription
|
||||
from models.database.vendor import VendorUser
|
||||
|
||||
@@ -10,7 +10,7 @@ from app.exceptions import (
|
||||
ResourceNotFoundException,
|
||||
ValidationException,
|
||||
)
|
||||
from app.services.vendor_email_settings_service import VendorEmailSettingsService
|
||||
from app.modules.cms.services.vendor_email_settings_service import VendorEmailSettingsService
|
||||
from models.database import VendorEmailSettings, TierCode
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ Tests the vendor product catalog service operations.
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import ProductNotFoundException
|
||||
from app.services.vendor_product_service import VendorProductService
|
||||
from app.modules.catalog.exceptions import ProductNotFoundException
|
||||
from app.modules.catalog.services.vendor_product_service import VendorProductService
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
@@ -5,16 +5,16 @@ import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
from app.exceptions import (
|
||||
from app.exceptions import ValidationException
|
||||
from app.modules.tenancy.exceptions import (
|
||||
InvalidVendorDataException,
|
||||
MarketplaceProductNotFoundException,
|
||||
ProductAlreadyExistsException,
|
||||
UnauthorizedVendorAccessException,
|
||||
ValidationException,
|
||||
VendorAlreadyExistsException,
|
||||
VendorNotFoundException,
|
||||
)
|
||||
from app.services.vendor_service import VendorService
|
||||
from app.modules.marketplace.exceptions import MarketplaceProductNotFoundException
|
||||
from app.modules.catalog.exceptions import ProductAlreadyExistsException
|
||||
from app.modules.tenancy.services.vendor_service import VendorService
|
||||
from models.database.company import Company
|
||||
from models.database.vendor import Vendor
|
||||
from app.modules.catalog.schemas import ProductCreate
|
||||
@@ -642,7 +642,7 @@ class TestVendorServiceUpdate:
|
||||
"""Test update fails for unauthorized user."""
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.exceptions import InsufficientPermissionsException
|
||||
from app.modules.tenancy.exceptions import InsufficientPermissionsException
|
||||
from models.database.user import User
|
||||
|
||||
class VendorUpdate(BaseModel):
|
||||
@@ -694,7 +694,7 @@ class TestVendorServiceUpdate:
|
||||
self, db, other_company, test_vendor
|
||||
):
|
||||
"""Test marketplace settings update fails for unauthorized user."""
|
||||
from app.exceptions import InsufficientPermissionsException
|
||||
from app.modules.tenancy.exceptions import InsufficientPermissionsException
|
||||
from models.database.user import User
|
||||
|
||||
other_user = db.query(User).filter(User.id == other_company.owner_user_id).first()
|
||||
@@ -722,7 +722,7 @@ class TestVendorServiceSingleton:
|
||||
|
||||
def test_singleton_exists(self):
|
||||
"""Test vendor_service singleton exists."""
|
||||
from app.services.vendor_service import vendor_service
|
||||
from app.modules.tenancy.services.vendor_service import vendor_service
|
||||
|
||||
assert vendor_service is not None
|
||||
assert isinstance(vendor_service, VendorService)
|
||||
|
||||
Reference in New Issue
Block a user