Ejemplo n.º 1
0
    def test_real_search_without_exception(self, mock_livestatus) -> None:
        builder = IndexBuilder(real_match_item_generator_registry)

        with self._livestatus_mock(mock_livestatus):
            builder.build_full_index()

        assert builder.index_is_built(builder._redis_client)

        searcher = IndexSearcher()
        searcher._redis_client = builder._redis_client

        assert len(list(searcher.search("Host"))) > 4
Ejemplo n.º 2
0
    def test_real_search_without_exception(
        self,
        mock_livestatus: MockLiveStatusConnection,
    ) -> None:
        builder = IndexBuilder(real_match_item_generator_registry)

        with self._livestatus_mock(mock_livestatus):
            builder.build_full_index()

        assert builder.index_is_built(builder._redis_client)

        searcher = IndexSearcher(
            PermissionsHandler(URLChecker[ModeEditHost](ModeEditHost)))
        searcher._redis_client = builder._redis_client

        assert len(list(searcher.search("Host"))) > 4
Ejemplo n.º 3
0
 def test_update_only_not_built(
     self,
     index_builder: IndexBuilder,
 ) -> None:
     index_builder.build_changed_sub_indices("something")
     assert not index_builder.index_is_built(index_builder._redis_client)