Add test for push and pull logs

Fixes #961
This commit is contained in:
Joseph Schorr 2015-11-24 15:23:45 -05:00
parent 0dbd19a236
commit b2df3bc9cb

View file

@ -543,6 +543,31 @@ class V2RegistryPullMixin(V2RegistryMixin):
class RegistryTestsMixin(object):
def test_push_pull_logging(self):
# Push a new repository.
self.do_push('public', 'newrepo', 'public', 'password')
# Retrieve the logs and ensure the push was added.
self.conduct_api_login('public', 'password')
result = self.conduct('GET', '/api/v1/repository/public/newrepo/logs')
logs = result.json()['logs']
self.assertEquals(1, len(logs))
self.assertEquals('push_repo', logs[0]['kind'])
self.assertEquals('public', logs[0]['performer']['name'])
# Pull the repository.
self.do_pull('public', 'newrepo', 'public', 'password')
# Retrieve the logs and ensure the pull was added.
result = self.conduct('GET', '/api/v1/repository/public/newrepo/logs')
logs = result.json()['logs']
self.assertEquals(2, len(logs))
self.assertEquals('pull_repo', logs[0]['kind'])
self.assertEquals('public', logs[0]['performer']['name'])
def test_pull_publicrepo_anonymous(self):
# Add a new repository under the public user, so we have a real repository to pull.
self.do_push('public', 'newrepo', 'public', 'password')