Changeset View
Changeset View
Standalone View
Standalone View
swh/search/tests/test_api_client.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import unittest | import unittest | ||||
import pytest | import pytest | ||||
from swh.core.api.tests.server_testing import ServerTestFixture | from swh.core.api.tests.server_testing import ServerTestFixture | ||||
from swh.search import get_search | from swh.search import get_search | ||||
from swh.search.api.server import app | from swh.search.api.server import app | ||||
from .test_elasticsearch import CommonElasticsearchSearchTest | from .test_elasticsearch import CommonElasticsearchSearchTest | ||||
from .test_in_memory import CommonInmemorySearchTest | |||||
class TestRemoteSearch( | class TestRemoteSearchElasticSearch( | ||||
CommonElasticsearchSearchTest, ServerTestFixture, unittest.TestCase | CommonElasticsearchSearchTest, ServerTestFixture, unittest.TestCase | ||||
): | ): | ||||
@pytest.fixture(autouse=True) | @pytest.fixture(autouse=True) | ||||
def _instantiate_search(self, elasticsearch_host): | def _instantiate_search(self, elasticsearch_host): | ||||
self._elasticsearch_host = elasticsearch_host | self._elasticsearch_host = elasticsearch_host | ||||
def setUp(self): | def setUp(self): | ||||
self.config = { | self.config = { | ||||
Show All 34 Lines | def reset(self): | ||||
search.deinitialize() | search.deinitialize() | ||||
search.initialize() | search.initialize() | ||||
@pytest.mark.skip( | @pytest.mark.skip( | ||||
"Elasticsearch also returns close matches, so this test would fail" | "Elasticsearch also returns close matches, so this test would fail" | ||||
) | ) | ||||
def test_origin_url_paging(self, count): | def test_origin_url_paging(self, count): | ||||
pass | pass | ||||
class TestRemoteSearchInMemory( | |||||
CommonInmemorySearchTest, ServerTestFixture, unittest.TestCase | |||||
): | |||||
def setUp(self): | |||||
self.config = { | |||||
"search": { | |||||
"cls": "memory", | |||||
} | |||||
} | |||||
self.app = app | |||||
super().setUp() | |||||
# self.reset() | |||||
self.search = get_search( | |||||
"remote", | |||||
url=self.url(), | |||||
) | |||||
def reset(self): | |||||
pass |