From e4d40e32894ccc2a9469edb0c181bb637aa5a0e3 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 11 Mar 2014 13:38:44 -0400 Subject: [PATCH] Add test for bad repo names currently breaking quay --- test/test_api_usage.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_api_usage.py b/test/test_api_usage.py index 04a999f1d..2be673f4c 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -767,6 +767,28 @@ class TestDeleteRepository(ApiTestCase): class TestGetRepository(ApiTestCase): PUBLIC_REPO = PUBLIC_USER + '/publicrepo' + + def test_getrepo_badnames(self): + self.login(ADMIN_ACCESS_USER) + + bad_names = ['logs', 'build', 'tokens'] + + # For each bad name, create the repo. + for bad_name in bad_names: + json = self.postJsonResponse('api.create_repo', + data=dict(repository=bad_name, + visibility='public', + description='')) + + # Make sure we can retrieve its information. + json = self.getJsonResponse('api.get_repo', + params=dict(repository=ADMIN_ACCESS_USER + '/' + bad_name)) + + self.assertEquals(ADMIN_ACCESS_USER, json['namespace']) + self.assertEquals(bad_name, json['name']) + self.assertEquals(True, json['is_public']) + + def test_getrepo_public_asguest(self): json = self.getJsonResponse('api.get_repo', params=dict(repository=self.PUBLIC_REPO))