Fix no search result for apps
This commit is contained in:
parent
f9e4150fab
commit
9c68cbd6e8
2 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,9 @@ def list_packages_query(namespace=None, media_type=None, search_query=None, user
|
||||||
username=username,
|
username=username,
|
||||||
search_fields=fields,
|
search_fields=fields,
|
||||||
limit=50)
|
limit=50)
|
||||||
|
if not repositories:
|
||||||
|
return []
|
||||||
|
|
||||||
repo_query = (Repository
|
repo_query = (Repository
|
||||||
.select(Repository, Namespace.username)
|
.select(Repository, Namespace.username)
|
||||||
.join(Namespace, on=(Repository.namespace_user == Namespace.id))
|
.join(Namespace, on=(Repository.namespace_user == Namespace.id))
|
||||||
|
|
|
@ -91,6 +91,18 @@ class TestServerQuayDB(BaseTestServer):
|
||||||
""" TODO: search cross namespace and package name """
|
""" TODO: search cross namespace and package name """
|
||||||
BaseTestServer.test_search_package_match(self, db_with_data1, client)
|
BaseTestServer.test_search_package_match(self, db_with_data1, client)
|
||||||
|
|
||||||
|
def test_list_search_package_match(self, db_with_data1, client):
|
||||||
|
url = self._url_for("api/v1/packages")
|
||||||
|
res = self.Client(client, self.headers()).get(url, params={'query': 'rocketchat'})
|
||||||
|
assert res.status_code == 200
|
||||||
|
assert len(self.json(res)) == 1
|
||||||
|
|
||||||
|
def test_list_search_package_no_match(self, db_with_data1, client):
|
||||||
|
url = self._url_for("api/v1/packages")
|
||||||
|
res = self.Client(client, self.headers()).get(url, params={'query': 'toto'})
|
||||||
|
assert res.status_code == 200
|
||||||
|
assert len(self.json(res)) == 0
|
||||||
|
|
||||||
@pytest.mark.xfail
|
@pytest.mark.xfail
|
||||||
def test_push_package_already_exists_force(self, db_with_data1, package_b64blob, client):
|
def test_push_package_already_exists_force(self, db_with_data1, package_b64blob, client):
|
||||||
""" No force push implemented """
|
""" No force push implemented """
|
||||||
|
|
Reference in a new issue