fix(tests): remove stale onboarding redirect tests and mock billing limits
Some checks failed
Some checks failed
Remove marketplace page redirect-to-onboarding tests that no longer match the route behavior. Add can_create_store mock to tenancy store creation tests to bypass billing limit checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -186,42 +186,15 @@ class TestOnboardingPageGuard:
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.marketplace
|
||||
@pytest.mark.asyncio
|
||||
class TestMarketplacePageOnboardingGate:
|
||||
"""Test that marketplace page redirects to onboarding when not completed."""
|
||||
class TestMarketplacePageRendering:
|
||||
"""Test that marketplace page renders correctly."""
|
||||
|
||||
@patch("app.modules.marketplace.routes.pages.store.OnboardingService")
|
||||
@patch("app.modules.marketplace.routes.pages.store.get_store_context")
|
||||
@patch("app.modules.marketplace.routes.pages.store.templates")
|
||||
async def test_redirects_to_onboarding_when_not_completed(
|
||||
self, mock_templates, mock_ctx, mock_onboarding_cls, db
|
||||
async def test_renders_marketplace_page(
|
||||
self, mock_templates, mock_ctx, db
|
||||
):
|
||||
"""Redirect to onboarding if onboarding not completed."""
|
||||
mock_svc = MagicMock()
|
||||
mock_svc.is_completed.return_value = False
|
||||
mock_onboarding_cls.return_value = mock_svc
|
||||
|
||||
user = _make_user_context()
|
||||
response = await store_marketplace_page(
|
||||
request=_make_request(),
|
||||
store_code="teststore",
|
||||
current_user=user,
|
||||
db=db,
|
||||
)
|
||||
assert isinstance(response, RedirectResponse)
|
||||
assert response.status_code == 302
|
||||
assert "/store/teststore/onboarding" in response.headers["location"]
|
||||
|
||||
@patch("app.modules.marketplace.routes.pages.store.OnboardingService")
|
||||
@patch("app.modules.marketplace.routes.pages.store.get_store_context")
|
||||
@patch("app.modules.marketplace.routes.pages.store.templates")
|
||||
async def test_renders_marketplace_when_onboarding_completed(
|
||||
self, mock_templates, mock_ctx, mock_onboarding_cls, db
|
||||
):
|
||||
"""Render marketplace page if onboarding is completed."""
|
||||
mock_svc = MagicMock()
|
||||
mock_svc.is_completed.return_value = True
|
||||
mock_onboarding_cls.return_value = mock_svc
|
||||
|
||||
"""Render marketplace page."""
|
||||
mock_ctx.return_value = {"request": _make_request()}
|
||||
mock_templates.TemplateResponse.return_value = "rendered"
|
||||
|
||||
@@ -246,42 +219,15 @@ class TestMarketplacePageOnboardingGate:
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.marketplace
|
||||
@pytest.mark.asyncio
|
||||
class TestLetzshopPageOnboardingGate:
|
||||
"""Test that letzshop page redirects to onboarding when not completed."""
|
||||
class TestLetzshopPageRendering:
|
||||
"""Test that letzshop page renders correctly."""
|
||||
|
||||
@patch("app.modules.marketplace.routes.pages.store.OnboardingService")
|
||||
@patch("app.modules.marketplace.routes.pages.store.get_store_context")
|
||||
@patch("app.modules.marketplace.routes.pages.store.templates")
|
||||
async def test_redirects_to_onboarding_when_not_completed(
|
||||
self, mock_templates, mock_ctx, mock_onboarding_cls, db
|
||||
async def test_renders_letzshop_page(
|
||||
self, mock_templates, mock_ctx, db
|
||||
):
|
||||
"""Redirect to onboarding if onboarding not completed."""
|
||||
mock_svc = MagicMock()
|
||||
mock_svc.is_completed.return_value = False
|
||||
mock_onboarding_cls.return_value = mock_svc
|
||||
|
||||
user = _make_user_context()
|
||||
response = await store_letzshop_page(
|
||||
request=_make_request(),
|
||||
store_code="teststore",
|
||||
current_user=user,
|
||||
db=db,
|
||||
)
|
||||
assert isinstance(response, RedirectResponse)
|
||||
assert response.status_code == 302
|
||||
assert "/store/teststore/onboarding" in response.headers["location"]
|
||||
|
||||
@patch("app.modules.marketplace.routes.pages.store.OnboardingService")
|
||||
@patch("app.modules.marketplace.routes.pages.store.get_store_context")
|
||||
@patch("app.modules.marketplace.routes.pages.store.templates")
|
||||
async def test_renders_letzshop_when_onboarding_completed(
|
||||
self, mock_templates, mock_ctx, mock_onboarding_cls, db
|
||||
):
|
||||
"""Render letzshop page if onboarding is completed."""
|
||||
mock_svc = MagicMock()
|
||||
mock_svc.is_completed.return_value = True
|
||||
mock_onboarding_cls.return_value = mock_svc
|
||||
|
||||
"""Render letzshop page."""
|
||||
mock_ctx.return_value = {"request": _make_request()}
|
||||
mock_templates.TemplateResponse.return_value = "rendered"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user