summaryrefslogtreecommitdiff
path: root/tests/oci-registry-server.py
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2019-09-03 16:06:06 +0200
committerAlexander Larsson <alexl@redhat.com>2019-09-03 16:06:06 +0200
commit24e5f368d8a6926c4778afc8b215633837d7774e (patch)
tree8a3024d298c5da9e2db266377bcbe13c5df5470f /tests/oci-registry-server.py
parent017216633128c5fd58bfad64dd2a05be6d0b66d5 (diff)
downloadflatpak-24e5f368d8a6926c4778afc8b215633837d7774e.tar.gz
tests: Add tests for oci registries using labels instead of annotationswip/oci-labels
Diffstat (limited to 'tests/oci-registry-server.py')
-rw-r--r--tests/oci-registry-server.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/oci-registry-server.py b/tests/oci-registry-server.py
index f123edc7..b8b33cab 100644
--- a/tests/oci-registry-server.py
+++ b/tests/oci-registry-server.py
@@ -179,10 +179,15 @@ class RequestHandler(http_server.BaseHTTPRequestHandler):
if detach_icons:
for size in (64, 128):
annotation = 'org.freedesktop.appstream.icon-{}'.format(size)
- icon = manifest['annotations'].get(annotation)
+ icon = manifest.get('annotations', {}).get(annotation)
if icon:
path = cache_icon(icon)
manifest['annotations'][annotation] = path
+ else:
+ icon = config.get('config', {}).get('Labels', {}).get(annotation)
+ if icon:
+ path = cache_icon(icon)
+ config['config']['Labels'][annotation] = path
image = {
"Tags": [tag],
@@ -190,8 +195,8 @@ class RequestHandler(http_server.BaseHTTPRequestHandler):
"MediaType": "application/vnd.oci.image.manifest.v1+json",
"OS": config['os'],
"Architecture": config['architecture'],
- "Annotations": manifest['annotations'],
- "Labels": {},
+ "Annotations": manifest.get('annotations', {}),
+ "Labels": config.get('config', {}).get('Labels', {}),
}
# Delete old versions