Fix no search result for apps

This commit is contained in:
Antoine Legrand 2017-06-05 22:59:56 +02:00
parent f9e4150fab
commit 9c68cbd6e8
2 changed files with 15 additions and 0 deletions

View file

@ -16,6 +16,9 @@ def list_packages_query(namespace=None, media_type=None, search_query=None, user
username=username,
search_fields=fields,
limit=50)
if not repositories:
return []
repo_query = (Repository
.select(Repository, Namespace.username)
.join(Namespace, on=(Repository.namespace_user == Namespace.id))

View file

@ -91,6 +91,18 @@ class TestServerQuayDB(BaseTestServer):
""" TODO: search cross namespace and package name """
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
def test_push_package_already_exists_force(self, db_with_data1, package_b64blob, client):
""" No force push implemented """