MCPcopy
hub / github.com/GitGuardian/ggshield / test_auto_ignore_cache_file

Function test_auto_ignore_cache_file

tests/unit/core/test_cache.py:95–110  ·  view source on GitHub ↗

GIVEN a cache file in a git repository WHEN it is not ignored by git THEN the cache file is automatically added to the gitignore file

(tmp_path)

Source from the content-addressed store, hash-verified

93
94
95def test_auto_ignore_cache_file(tmp_path):
96 """
97 GIVEN a cache file in a git repository
98 WHEN it is not ignored by git
99 THEN the cache file is automatically added to the gitignore file
100 """
101 Repository.create(tmp_path)
102
103 with open(tmp_path / ".cache_ggshield", "w") as file:
104 json.dump({"last_found_secrets": [{"name": "", "match": "XXX"}]}, file)
105
106 with cd(str(tmp_path)):
107 assert not is_gitignored(Path(".cache_ggshield"))
108
109 Cache()
110 assert is_gitignored(Path(".cache_ggshield"))
111
112
113def test_no_duplicate_gitignore_entry(tmp_path):

Callers

nothing calls this directly

Calls 4

cdFunction · 0.90
is_gitignoredFunction · 0.90
CacheClass · 0.90
createMethod · 0.45

Tested by

no test coverage detected