peregrine/tests/test_app_gating.py
pyr0ball e87c707dd9
Some checks failed
CI / Backend (Python) (push) Failing after 30s
CI / Frontend (Vue) (push) Successful in 22s
CI / Backend (Python) (pull_request) Failing after 27s
CI / Frontend (Vue) (pull_request) Successful in 20s
chore(lint): ruff auto-fix unused imports in tests/
Removes unused imports flagged by ruff F401 across 47 test files.
Auto-fix only — imports verified unused by static analysis.
2026-05-20 23:07:52 -07:00

38 lines
1.3 KiB
Python

import yaml
from scripts.user_profile import UserProfile
def test_wizard_gating_logic(tmp_path):
"""Wizard gate should trigger when user.yaml is absent."""
missing = tmp_path / "user.yaml"
assert not UserProfile.exists(missing)
def test_wizard_gating_passes_after_setup(tmp_path):
"""Wizard gate should clear once user.yaml is written."""
p = tmp_path / "user.yaml"
p.write_text(yaml.dump({"name": "Test User", "services": {}}))
assert UserProfile.exists(p)
def test_wizard_gating_empty_file_still_exists(tmp_path):
"""An empty user.yaml still clears the gate (wizard already ran)."""
p = tmp_path / "user.yaml"
p.write_text("")
assert UserProfile.exists(p)
def test_wizard_incomplete_triggers_wizard(tmp_path):
"""wizard_complete: false should be treated as 'wizard not done'."""
p = tmp_path / "user.yaml"
p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: false\n")
from scripts.user_profile import UserProfile
u = UserProfile(p)
assert u.wizard_complete is False
def test_wizard_complete_does_not_trigger(tmp_path):
p = tmp_path / "user.yaml"
p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: true\n")
from scripts.user_profile import UserProfile
u = UserProfile(p)
assert u.wizard_complete is True