Пример #1
0
    def test_repeat_indexing_empty_lines_are_skipped(self):
        self.instance.read_from_cache.return_value = ["   "]

        repeater = IndexRepeater(self.cache, self.indexer)
        repeater.reindex()

        self.cache.clear_cache.assert_called_once()
        self.assertFalse(self.indexer.index_from_json.called)
Пример #2
0
    def test_repeat_indexing_on_data_available_throw_no_exception(self):
        self.instance.read_from_cache.return_value = ["lineOne\n", "lineTwo\n"]

        repeater = IndexRepeater(self.cache, self.indexer)
        repeater.reindex()

        self.cache.read_from_cache.assert_called_once()
        self.cache.clear_cache.assert_any_call()
        self.indexer.index_from_json.assert_any_call("lineTwo")
        self.indexer.index_from_json.assert_any_call("lineOne")