Fix popularity metrics on list repos API

This commit is contained in:
Joseph Schorr 2016-07-06 16:15:54 -04:00
parent 6bde6406c9
commit e252ee07cb
4 changed files with 18 additions and 11 deletions

View file

@ -1479,6 +1479,10 @@ class TestListRepos(ApiTestCase):
self.assertEquals(ORGANIZATION, repo['namespace'])
def test_listrepos_allparams(self):
# Add a repository action count entry for one of the org repos.
repo = model.repository.get_repository(ORGANIZATION, ORG_REPO)
RepositoryActionCount.create(repository=repo, count=10, date=datetime.datetime.utcnow())
self.login(ADMIN_ACCESS_USER)
# Queries: Base + the list query + the popularity and last modified queries + full perms load
@ -1491,8 +1495,11 @@ class TestListRepos(ApiTestCase):
self.assertGreater(len(json['repositories']), 0)
for repo in json['repositories']:
self.assertEquals(ORGANIZATION, repo['namespace'])
for repository in json['repositories']:
self.assertEquals(ORGANIZATION, repository['namespace'])
if repository['name'] == ORG_REPO:
self.assertGreater(repository['popularity'], 0)
def test_listrepos_starred_nouser(self):
self.getResponse(RepositoryList,