Add the ability to blacklist v2 for specific versions
This commit is contained in:
parent
4a84388f15
commit
766d60493f
7 changed files with 97 additions and 2 deletions
|
@ -181,13 +181,18 @@ class RegistryTestCaseMixin(LiveServerTestCase):
|
|||
|
||||
class BaseRegistryMixin(object):
|
||||
def conduct(self, method, url, headers=None, data=None, auth=None, params=None, expected_code=200,
|
||||
json_data=None):
|
||||
json_data=None, user_agent=None):
|
||||
params = params or {}
|
||||
params['_csrf_token'] = self.csrf_token
|
||||
|
||||
headers = headers or {}
|
||||
auth_tuple = None
|
||||
|
||||
if user_agent is not None:
|
||||
headers['User-Agent'] = user_agent
|
||||
else:
|
||||
headers['User-Agent'] = 'docker/1.9.1'
|
||||
|
||||
if self.docker_token:
|
||||
headers['X-Docker-Token'] = self.docker_token
|
||||
|
||||
|
@ -1026,6 +1031,9 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
# Try to get tags before a repo exists.
|
||||
self.conduct('GET', '/v2/devtable/doesnotexist/tags/list', auth='jwt', expected_code=401)
|
||||
|
||||
def test_one_five_blacklist(self):
|
||||
self.conduct('GET', '/v2/', expected_code=404, user_agent='Go 1.1 package http')
|
||||
|
||||
|
||||
class V1PushV2PullRegistryTests(V2RegistryPullMixin, V1RegistryPushMixin, RegistryTestsMixin,
|
||||
RegistryTestCaseMixin, LiveServerTestCase):
|
||||
|
|
Reference in a new issue