forked from ChelseaKR/queer-the-stacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_privacy_gitignore.py
More file actions
39 lines (30 loc) · 1.14 KB
/
Copy pathtest_privacy_gitignore.py
File metadata and controls
39 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Sensitive runtime artifacts must be impossible to stage accidentally."""
from __future__ import annotations
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def _ignored(paths: list[str]) -> set[str]:
result = subprocess.run( # noqa: S603 - fixed local git diagnostic
["git", "check-ignore", "--no-index", "--stdin"], # noqa: S607 - fixed executable
cwd=ROOT,
input="\n".join(paths),
text=True,
capture_output=True,
check=False,
)
assert result.returncode in {0, 1}, result.stderr
return set(result.stdout.splitlines())
def test_sensitive_runtime_artifacts_are_ignored() -> None:
sensitive = [
"stacks.toml",
"data/app-state.sqlite-wal",
"data/app-state.sqlite-shm",
"data/app-state.sqlite-journal",
"data/catalog-response-cache.json",
"data/lists.json",
"data/lenses.toml",
"data/backups/20260725.sqlite",
]
assert _ignored(sensitive) == set(sensitive)
def test_shipped_lens_example_remains_trackable() -> None:
assert _ignored(["examples/lenses.example.toml"]) == set()