Ejemplo n.º 1
0
    def test_patch_unpatch(self):
        self.patch_algoliasearch()
        # Test patch idempotence
        patch()
        patch()

        self.perform_search('test search')

        spans = self.get_spans()
        self.reset()
        assert spans, spans
        assert len(spans) == 1

        # Test unpatch
        unpatch()

        self.index.search('test search')

        spans = self.get_spans()
        self.reset()
        assert not spans, spans

        # Test patch again
        self.reset()
        patch()

        self.index.search('test search')

        spans = self.get_spans()
        assert spans, spans
        assert len(spans) == 1
Ejemplo n.º 2
0
 def patch_algoliasearch(self):
     patch()
     Pin.override(self.index, tracer=self.tracer)