Add validation of Docker V2_1 schemas and add a test for PUTing an invalid schema
This commit is contained in:
parent
11e3724919
commit
f9bd7ef42b
2 changed files with 90 additions and 2 deletions
|
@ -1371,8 +1371,8 @@ class V1RegistryTests(V1RegistryPullMixin, V1RegistryPushMixin, RegistryTestsMix
|
|||
# Try some logins.
|
||||
self.conduct('POST', '/v1/users', json_data={'username': 'freshuser'}, expected_code=400)
|
||||
resp = self.conduct('POST', '/v1/users',
|
||||
json_data={'username': 'devtable', 'password': 'password'},
|
||||
expected_code=400)
|
||||
json_data={'username': 'devtable', 'password': 'password'},
|
||||
expected_code=400)
|
||||
|
||||
# Because Docker
|
||||
self.assertEquals('"Username or email already exists"', resp.text)
|
||||
|
@ -1623,6 +1623,20 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
headers={'Content-Type': 'application/vnd.docker.distribution.manifest.v2+json'},
|
||||
auth='jwt')
|
||||
|
||||
def test_invalid_manifest(self):
|
||||
namespace = 'devtable'
|
||||
repository = 'somerepo'
|
||||
tag_name = 'sometag'
|
||||
|
||||
repo_name = _get_repo_name(namespace, repository)
|
||||
|
||||
self.v2_ping()
|
||||
self.do_auth('devtable', 'password', namespace, repository, scopes=['push', 'pull'])
|
||||
|
||||
self.conduct('PUT', '/v2/%s/manifests/%s' % (repo_name, tag_name),
|
||||
data='{}', expected_code=400,
|
||||
auth='jwt')
|
||||
|
||||
def test_oci_manifest_type(self):
|
||||
namespace = 'devtable'
|
||||
repository = 'somerepo'
|
||||
|
|
Reference in a new issue