Handle additional error cases in the manifest schema 1 implementation

This commit is contained in:
Joseph Schorr 2019-02-05 18:06:03 -05:00
parent 82897a2bba
commit 097311f360
2 changed files with 22 additions and 2 deletions

View file

@ -197,3 +197,19 @@ def test_validate_manifest_with_emoji(with_key):
# Ensure the manifest can be reloaded.
built_bytes = built.bytes.as_encoded_str()
DockerSchema1Manifest(Bytes.for_string_or_unicode(built_bytes))
@pytest.mark.parametrize('with_key', [
None,
docker_v2_signing_key,
])
def test_validate_manifest_with_none_metadata_layer(with_key):
builder = DockerSchema1ManifestBuilder('somenamespace', 'somerepo', 'sometag')
builder.add_layer('sha256:abcde', None)
built = builder.build(with_key, ensure_ascii=False)
built._validate()
# Ensure the manifest can be reloaded.
built_bytes = built.bytes.as_encoded_str()
DockerSchema1Manifest(Bytes.for_string_or_unicode(built_bytes))