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)
| 93 | |
| 94 | |
| 95 | def 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 | |
| 113 | def test_no_duplicate_gitignore_entry(tmp_path): |
nothing calls this directly
no test coverage detected