26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
import json
|
|
import pathlib
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
|
|
|
from settings_filter import cleaned
|
|
from git_repo import git
|
|
from repo_checks.test_python_floor import ROOT
|
|
|
|
INSTALL = "git config filter.settings.clean bin/settings_filter.py"
|
|
|
|
|
|
class Settings(unittest.TestCase):
|
|
def test_the_stored_settings_hold_no_model_and_sorted_keys(self):
|
|
# The index, not the working file: the working file holds this machine's model in Claude Code's key order.
|
|
stored = git("show", ":settings.json", cwd=str(ROOT))
|
|
self.assertIsInstance(stored, str, stored)
|
|
self.assertNotIn("model", json.loads(stored))
|
|
self.assertEqual(stored, cleaned(stored), f"commit settings.json with the filter on: {INSTALL}")
|
|
|
|
def test_the_readme_installs_the_filter_git_attributes_names_for_the_root_settings_only(self):
|
|
self.assertEqual("/settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8"))
|
|
self.assertIn(f"{INSTALL}\n", (ROOT / "README.md").read_text(encoding="utf-8"))
|