Пример #1
0
    def test_index_all(self, monkeypatch):
        bulk_index = pretend.call_recorder(lambda es, docs: None)
        monkeypatch.setattr(indexes, "bulk_index", bulk_index)

        index = pretend.stub(
            _index="warehouse",
            es=pretend.stub(),
        )

        bmap = BaseMapping(index=index)
        bmap.get_indexable = pretend.call_recorder(lambda: [])
        bmap.index_all()

        assert bulk_index.calls == [pretend.call(index.es, [])]
        assert bmap.get_indexable.calls == [pretend.call()]
Пример #2
0
    def test_index_all(self, monkeypatch):
        bulk_index = pretend.call_recorder(lambda es, docs: None)
        monkeypatch.setattr(indexes, "bulk_index", bulk_index)

        index = pretend.stub(
            _index="warehouse",
            es=pretend.stub(),
        )

        bmap = BaseMapping(index=index)
        bmap.get_indexable = pretend.call_recorder(lambda: [])
        bmap.index_all()

        assert bulk_index.calls == [pretend.call(index.es, [])]
        assert bmap.get_indexable.calls == [pretend.call()]
Пример #3
0
    def test_search(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.search(None)
Пример #4
0
    def test_extract_document(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.extract_document(None)
Пример #5
0
    def test_get_indexable(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.get_indexable()
Пример #6
0
    def test_search(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.search(None)
Пример #7
0
    def test_extract_document(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.extract_document(None)
Пример #8
0
    def test_get_indexable(self):
        bmap = BaseMapping(index=pretend.stub())

        with pytest.raises(NotImplementedError):
            bmap.get_indexable()