mirror of
https://github.com/wizarrrr/wizarr.git
synced 2026-07-31 07:17:10 -04:00
- Fix 55 test failures caused by missing request contexts and incorrect session_transaction() usage across 8 test files - Fix ruff import sorting errors and unused imports - Fix 122 type errors: rename method override parameters to match base classes, add None guards for fetchone()/datetime, widen dict type annotations, add type: ignore for SQLAlchemy stub limitations - Add [tool.ty.rules] config to suppress unsupported-base warnings - Fix _ variable shadowing gettext in wizard routes - Add noqa: ARG002 for unused method arguments required by base class
32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
"""
|
|
Unit tests for pre-wizard endpoint.
|
|
|
|
Tests verify that the pre-wizard routes are properly registered and handle basic cases.
|
|
"""
|
|
|
|
|
|
class TestPreWizardRouteRegistration:
|
|
"""Test that pre-wizard routes are properly registered."""
|
|
|
|
def test_pre_wizard_route_exists(self, app):
|
|
"""Test that /wizard/pre-wizard route is registered."""
|
|
with app.app_context():
|
|
rules = [rule.rule for rule in app.url_map.iter_rules()]
|
|
assert "/wizard/pre-wizard" in rules
|
|
assert "/wizard/pre-wizard/<int:idx>" in rules
|
|
|
|
def test_pre_wizard_redirects_without_invite_code(self, app, client):
|
|
"""Test that accessing pre-wizard without invite code redirects to home."""
|
|
response = client.get("/wizard/pre-wizard", follow_redirects=False)
|
|
assert response.status_code == 302
|
|
assert response.location == "/"
|
|
|
|
def test_pre_wizard_redirects_with_invalid_invite_code(self, app, client):
|
|
"""Test that accessing pre-wizard with invalid code redirects to home."""
|
|
with client.session_transaction() as sess:
|
|
sess["wizarr_invite_code"] = "INVALID123"
|
|
|
|
response = client.get("/wizard/pre-wizard", follow_redirects=False)
|
|
assert response.status_code == 302
|
|
assert response.location == "/"
|