diff --git a/test/registry_tests.py b/test/registry_tests.py index 74220c679..914e08088 100644 --- a/test/registry_tests.py +++ b/test/registry_tests.py @@ -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')