Clean up the repository list API and loads stars with it
We load stars with the same list API now so that we get the extra metadata needed in the repo list (popularity and last modified)
This commit is contained in:
parent
bb269a56b6
commit
a0c4e72f13
7 changed files with 107 additions and 56 deletions
|
@ -1281,30 +1281,45 @@ class TestListRepos(ApiTestCase):
|
|||
params=dict(namespace=ORGANIZATION,
|
||||
public=False))
|
||||
|
||||
self.assertTrue(len(json['repositories']) > 0)
|
||||
|
||||
for repo in json['repositories']:
|
||||
self.assertEquals(ORGANIZATION, repo['namespace'])
|
||||
|
||||
def test_listrepos_limit(self):
|
||||
self.login(READ_ACCESS_USER)
|
||||
json = self.getJsonResponse(RepositoryList, params=dict(limit=2))
|
||||
|
||||
self.assertEquals(len(json['repositories']), 2)
|
||||
|
||||
def test_action_last_modified(self):
|
||||
self.login(READ_ACCESS_USER)
|
||||
json = self.getJsonResponse(RepositoryList, params=dict(last_modified=True, popularity=True))
|
||||
self.assertTrue(len(json['repositories']) > 2)
|
||||
json = self.getJsonResponse(RepositoryList, params=dict(limit=1))
|
||||
self.assertEquals(len(json['repositories']), 1)
|
||||
|
||||
def test_listrepos_allparams(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
json = self.getJsonResponse(RepositoryList,
|
||||
params=dict(namespace=ORGANIZATION,
|
||||
public=False,
|
||||
last_modified=True))
|
||||
|
||||
# Queries: Base + the list query + the popularity and last modified queries
|
||||
with assert_query_count(BASE_LOGGEDIN_QUERY_COUNT + 3):
|
||||
json = self.getJsonResponse(RepositoryList,
|
||||
params=dict(namespace=ORGANIZATION,
|
||||
public=False,
|
||||
last_modified=True,
|
||||
popularity=True))
|
||||
|
||||
self.assertTrue(len(json['repositories']) > 0)
|
||||
|
||||
for repo in json['repositories']:
|
||||
self.assertEquals(ORGANIZATION, repo['namespace'])
|
||||
|
||||
def test_listrepos_starred(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
json = self.getJsonResponse(RepositoryList,
|
||||
params=dict(last_modified=True,
|
||||
popularity=True,
|
||||
starred=True))
|
||||
|
||||
self.assertTrue(len(json['repositories']) > 0)
|
||||
|
||||
for repo in json['repositories']:
|
||||
self.assertTrue(repo['is_starred'])
|
||||
|
||||
def test_listrepos_asguest_allparams(self):
|
||||
json = self.getJsonResponse(RepositoryList,
|
||||
params=dict(namespace=ORGANIZATION,
|
||||
|
|
Reference in a new issue