def test_store_index(tmpdir): """ Test the store index """ config = DEFAULT_CONFIG cache_path = pathlib.Path(tmpdir) / ".wily" cache_path.mkdir() config.cache_path = cache_path config.path = tmpdir _TEST_INDEX = [{ "message": "a", "date": 1234 }, { "message": "b", "date": 1345 }] fn = cache.store_archiver_index(config, ARCHIVER_GIT, _TEST_INDEX) with open(fn) as cache_item: result = json.load(cache_item) assert isinstance(result, list) assert result[0] == _TEST_INDEX[1]
def save(self): """Save the index data back to the wily cache.""" data = [i.asdict() for i in self._revisions.values()] logger.debug("Saving data") cache.store_archiver_index(self.config, self.archiver, data)