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

Method test_save_cache_first_time

tests/unit/core/test_cache.py:69–80  ·  view source on GitHub ↗

GIVEN no existing cache WHEN save is called but there are (new entries/no entries in memory) THEN it should (create/not create) the file

(self, isolated_fs, with_entry)

Source from the content-addressed store, hash-verified

67
68 @pytest.mark.parametrize("with_entry", [True, False])
69 def test_save_cache_first_time(self, isolated_fs, with_entry):
70 """
71 GIVEN no existing cache
72 WHEN save is called but there are (new entries/no entries in memory)
73 THEN it should (create/not create) the file
74 """
75 cache = Cache()
76 if with_entry:
77 cache.update_cache(last_found_secrets=[{"match": "XXX"}])
78 cache.save()
79
80 assert os.path.isfile(".cache_ggshield") is with_entry
81
82 def test_max_commits_for_hook_setting(self):
83 """

Callers

nothing calls this directly

Calls 3

update_cacheMethod · 0.95
saveMethod · 0.95
CacheClass · 0.90

Tested by

no test coverage detected