Merge pull request #978 from coreos-inc/pushpulllogs
Add test for push and pull logs
This commit is contained in:
commit
c279d904bd
1 changed files with 25 additions and 0 deletions
|
@ -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')
|
||||
|
|
Reference in a new issue