Make sure to decode manifests into utf-8 when necessary

This fixes a decoding error
This commit is contained in:
Joseph Schorr 2018-12-17 16:31:24 -05:00
parent 6cc7102ec8
commit 48e584905a
15 changed files with 268 additions and 32 deletions

View file

@ -1773,3 +1773,33 @@ def test_pull_manifest_list_schema2_only(v22_protocol, basic_images, different_i
if has_amd64_linux:
assert result.manifests['latest'].media_type == DOCKER_SCHEMA2_MANIFEST_CONTENT_TYPE
def test_push_pull_unicode(pusher, puller, unicode_images, liveserver_session, app_reloader):
""" Test: Push an image with unicode inside and then pull it. """
credentials = ('devtable', 'password')
# Push a new repository.
pusher.push(liveserver_session, 'devtable', 'newrepo', 'latest', unicode_images,
credentials=credentials)
# Pull the repository to verify.
puller.pull(liveserver_session, 'devtable', 'newrepo', 'latest', unicode_images,
credentials=credentials)
def test_push_pull_unicode_direct(pusher, puller, unicode_images, liveserver_session, app_reloader):
""" Test: Push an image with *unescaped* unicode inside and then pull it. """
credentials = ('devtable', 'password')
# Turn off automatic unicode encoding when building the manifests.
options = ProtocolOptions()
options.ensure_ascii = False
# Push a new repository.
pusher.push(liveserver_session, 'devtable', 'newrepo', 'latest', unicode_images,
credentials=credentials, options=options)
# Pull the repository to verify.
puller.pull(liveserver_session, 'devtable', 'newrepo', 'latest', unicode_images,
credentials=credentials, options=options)