feat: cover letter training export (Phase 1) #111
2 changed files with 22 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ _DEFAULTS = {
|
|||
"tier": "free",
|
||||
"dev_tier_override": None,
|
||||
"wizard_complete": False,
|
||||
"training_export_opt_in": False,
|
||||
"wizard_step": 0,
|
||||
"dismissed_banners": [],
|
||||
"ui_preference": "streamlit",
|
||||
|
|
@ -77,6 +78,7 @@ class UserProfile:
|
|||
self.tier: str = data.get("tier", "free")
|
||||
self.dev_tier_override: str | None = data.get("dev_tier_override") or None
|
||||
self.wizard_complete: bool = bool(data.get("wizard_complete", False))
|
||||
self.training_export_opt_in: bool = bool(data.get("training_export_opt_in", False))
|
||||
self.wizard_step: int = int(data.get("wizard_step", 0))
|
||||
self.dismissed_banners: list[str] = list(data.get("dismissed_banners", []))
|
||||
raw_pref = data.get("ui_preference", "streamlit")
|
||||
|
|
@ -104,6 +106,7 @@ class UserProfile:
|
|||
"tier": self.tier,
|
||||
"dev_tier_override": self.dev_tier_override,
|
||||
"wizard_complete": self.wizard_complete,
|
||||
"training_export_opt_in": self.training_export_opt_in,
|
||||
"wizard_step": self.wizard_step,
|
||||
"dismissed_banners": self.dismissed_banners,
|
||||
"ui_preference": self.ui_preference,
|
||||
|
|
|
|||
|
|
@ -120,3 +120,22 @@ def test_strip_greeting_returns_original_when_no_body(tmp_path):
|
|||
# A letter that is only a salutation with no body should return the original text
|
||||
result = _strip_greeting("Dear Hiring Manager,")
|
||||
assert result == "Dear Hiring Manager,"
|
||||
|
||||
|
||||
def test_user_profile_training_opt_in_defaults_false(tmp_path):
|
||||
from scripts.user_profile import UserProfile
|
||||
yaml_path = tmp_path / "user.yaml"
|
||||
yaml_path.write_text("name: Test\nemail: test@example.com\n")
|
||||
profile = UserProfile(yaml_path)
|
||||
assert profile.training_export_opt_in is False
|
||||
|
||||
|
||||
def test_user_profile_training_opt_in_roundtrip(tmp_path):
|
||||
from scripts.user_profile import UserProfile
|
||||
yaml_path = tmp_path / "user.yaml"
|
||||
yaml_path.write_text("name: Test\nemail: test@example.com\n")
|
||||
profile = UserProfile(yaml_path)
|
||||
profile.training_export_opt_in = True
|
||||
profile.save()
|
||||
reloaded = UserProfile(yaml_path)
|
||||
assert reloaded.training_export_opt_in is True
|
||||
|
|
|
|||
Loading…
Reference in a new issue