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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user