From b2df3bc9cbf0d17d65a0c4e52e91cbb64d2ef471 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 24 Nov 2015 15:23:45 -0500 Subject: [PATCH] Add test for push and pull logs Fixes #961 --- test/registry_tests.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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')