Changeset View
Changeset View
Standalone View
Standalone View
swh/search/tests/test_search.py
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | def test_origin_visit_types_update_search(self): | ||||
["svn"], | ["svn"], | ||||
["hg"], | ["hg"], | ||||
["svn", "git"], | ["svn", "git"], | ||||
["hg", "git"], | ["hg", "git"], | ||||
["hg", "svn"], | ["hg", "svn"], | ||||
["git", "hg", "svn"], | ["git", "hg", "svn"], | ||||
] | ] | ||||
) | ) | ||||
vlorentz: docstring and/or better name, please | |||||
def test_origin_update_with_no_visit_types(self): | |||||
""" | |||||
Update an origin with visit types first then with no visit types, | |||||
check origin can still be searched with visit types afterwards. | |||||
""" | |||||
origin_url = "http://foobar.baz" | |||||
self.search.origin_update([{"url": origin_url, "visit_types": ["git"]}]) | |||||
self.search.flush() | |||||
self.search.origin_update([{"url": origin_url}]) | |||||
self.search.flush() | |||||
actual_page = self.search.origin_search(url_pattern="http", visit_types=["git"]) | |||||
assert actual_page.next_page_token is None | |||||
results = [r["url"] for r in actual_page.results] | |||||
expected_results = [origin_url] | |||||
assert results == expected_results | |||||
def test_origin_intrinsic_metadata_description(self): | def test_origin_intrinsic_metadata_description(self): | ||||
origin1_nothin = {"url": "http://origin1"} | origin1_nothin = {"url": "http://origin1"} | ||||
origin2_foobar = {"url": "http://origin2"} | origin2_foobar = {"url": "http://origin2"} | ||||
origin3_barbaz = {"url": "http://origin3"} | origin3_barbaz = {"url": "http://origin3"} | ||||
self.search.origin_update( | self.search.origin_update( | ||||
[ | [ | ||||
{**origin1_nothin, "intrinsic_metadata": {},}, | {**origin1_nothin, "intrinsic_metadata": {},}, | ||||
▲ Show 20 Lines • Show All 368 Lines • Show Last 20 Lines |
docstring and/or better name, please