self = <swh.search.tests.test_api_client.TestRemoteSearch testMethod=test_origin_keywords_search>
def test_origin_keywords_search(self):
ORIGINS = [
{
"url": "http://foobar.1.com",
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"description": "Django is a backend framework for applications",
"keywords": "django,backend,server,web",
},
},
{
"url": "http://foobar.2.com",
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"description": "Native Android applications are fast",
"keywords": "android,mobile,ui",
},
},
{
"url": "http://foobar.3.com",
"intrinsic_metadata": {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"description": "React helps you build powerful web applications",
"keywords": "react,web,ui",
},
},
]
self.search.origin_update(ORIGINS)
self.search.flush()
def _check_results(keywords, origin_indices):
page = self.search.origin_search(url_pattern="foobar", keywords=keywords)
results = [r["url"] for r in page.results]
assert results == [ORIGINS[index]["url"] for index in origin_indices]
_check_results(["powerful"], [2])
_check_results(["web"], [2, 0])
_check_results(["ui"], [1, 2])
# baseline: "applications" is common in all origins
> _check_results(["applications"], [2, 1, 0])
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_search.py:453:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
keywords = ['applications'], origin_indices = [2, 1, 0]
def _check_results(keywords, origin_indices):
page = self.search.origin_search(url_pattern="foobar", keywords=keywords)
results = [r["url"] for r in page.results]
> assert results == [ORIGINS[index]["url"] for index in origin_indices]
E AssertionError: assert ['http://foob...foobar.1.com'] == ['http://foob...foobar.1.com']
E At index 0 diff: 'http://foobar.2.com' != 'http://foobar.3.com'
E Full diff:
E - ['http://foobar.3.com', 'http://foobar.2.com', 'http://foobar.1.com']
E + ['http://foobar.2.com', 'http://foobar.3.com', 'http://foobar.1.com']
.tox/py3/lib/python3.7/site-packages/swh/search/tests/test_search.py:445: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 2 2021, 1:29 PM