tests: point model tests at db/ and align palette assertions

Made-with: Cursor
This commit is contained in:
2026-03-21 20:17:33 +13:00
parent aaca5435e9
commit 7b724e9ce1
3 changed files with 39 additions and 28 deletions

View File

@@ -2,10 +2,14 @@ from models.profile import Profile
import os
def test_profile():
"""Test Profile model CRUD operations."""
# Clean up any existing test file
if os.path.exists("Profile.json"):
os.remove("Profile.json")
"""Test Profile model CRUD operations.
Profile create() sets name, type, tabs (list of tab IDs), scenes, palette_id.
"""
# Clean up any existing test file (model uses db/profile.json from project root)
db_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "db")
profile_file = os.path.join(db_dir, "profile.json")
if os.path.exists(profile_file):
os.remove(profile_file)
profiles = Profile()
@@ -21,15 +25,13 @@ def test_profile():
assert profile is not None
assert profile["name"] == "test_profile"
assert "tabs" in profile
assert "palette" in profile
assert "tab_order" in profile
assert "palette_id" in profile
assert "type" in profile
print("\nTesting update profile")
update_data = {
"name": "updated_profile",
"tabs": {"tab1": {"names": ["1"], "presets": []}},
"palette": ["#FF0000", "#00FF00"],
"tab_order": ["tab1"]
"tabs": ["tab1"],
}
result = profiles.update(profile_id, update_data)
assert result is True