From a7b641652b9a05e3f4bfb5453c50aaf4ee2450ca Mon Sep 17 00:00:00 2001 From: Mek Date: Fri, 11 Aug 2023 14:21:48 -0700 Subject: [PATCH 1/9] delete unused static files for prod --- iiify/static/mirador-2.1/.gitignore | 1 - iiify/static/mirador-2.1/README.md | 2 - iiify/static/mirador-2.1/css/main.css | 15 -- iiify/static/mirador-2.1/index.html | 18 -- iiify/static/mirador-2.1/js/annotations.js | 215 --------------------- iiify/static/mirador-2.1/js/app.js | 24 --- iiify/static/mirador-2.1/js/crosslink.js | 158 --------------- 7 files changed, 433 deletions(-) delete mode 100644 iiify/static/mirador-2.1/.gitignore delete mode 100644 iiify/static/mirador-2.1/README.md delete mode 100644 iiify/static/mirador-2.1/css/main.css delete mode 100644 iiify/static/mirador-2.1/index.html delete mode 100644 iiify/static/mirador-2.1/js/annotations.js delete mode 100644 iiify/static/mirador-2.1/js/app.js delete mode 100644 iiify/static/mirador-2.1/js/crosslink.js diff --git a/iiify/static/mirador-2.1/.gitignore b/iiify/static/mirador-2.1/.gitignore deleted file mode 100644 index b38a05e..0000000 --- a/iiify/static/mirador-2.1/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mirador diff --git a/iiify/static/mirador-2.1/README.md b/iiify/static/mirador-2.1/README.md deleted file mode 100644 index 34c0266..0000000 --- a/iiify/static/mirador-2.1/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# mirador-crosslink-plugin -Crosslink.js is a Mirador Plugin which uses Web Annotations to create links between documents diff --git a/iiify/static/mirador-2.1/css/main.css b/iiify/static/mirador-2.1/css/main.css deleted file mode 100644 index d86b5c2..0000000 --- a/iiify/static/mirador-2.1/css/main.css +++ /dev/null @@ -1,15 +0,0 @@ -#viewer { - width: 100%; - height: 100%; - position: fixed; -} - -.xannotate-widget { - position: fixed; - left: 5px; - top: 5px; -} - -.mirador-container .mirador-main-menu-bar { - background-color: #465575; -} \ No newline at end of file diff --git a/iiify/static/mirador-2.1/index.html b/iiify/static/mirador-2.1/index.html deleted file mode 100644 index 7b5002b..0000000 --- a/iiify/static/mirador-2.1/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - Mirador Viewer - - - - - - - -
- - diff --git a/iiify/static/mirador-2.1/js/annotations.js b/iiify/static/mirador-2.1/js/annotations.js deleted file mode 100644 index 08e2ed5..0000000 --- a/iiify/static/mirador-2.1/js/annotations.js +++ /dev/null @@ -1,215 +0,0 @@ -/* - * All Endpoints need to have at least the following: - * annotationsList - current list of OA Annotations - * dfd - Deferred Object - * init() - * search(options, successCallback, errorCallback) - * create(oaAnnotation, successCallback, errorCallback) - * update(oaAnnotation, successCallback, errorCallback) - * deleteAnnotation(annotationID, successCallback, errorCallback) (delete is a reserved word) - * TODO: - * read() //not currently used - * - * Optional, if endpoint is not OA compliant: - * getAnnotationInOA(endpointAnnotation) - * getAnnotationInEndpoint(oaAnnotation) - */ - -var pragma_url, Annotation; -(function($){ - pragma_url = 'https://pragma.archivelab.org/annotations'; - Annotation = { - get: function(annotation_id, successCallback) { - jQuery.ajax({ - url: annotation_id, - type: 'GET', - dataType: 'json', - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - if (typeof successCallback === "function") { - successCallback(annotation); - } - } - }); - }, - update: function(oaAnnotation, successCallback, errorCallback) { - var annotation = jQuery.extend({}, oaAnnotation); - if(annotation.on.length) { - annotation.on = annotation.on[0]; - } - if (annotation.endpoint) { - delete annotation.endpoint; - } - - jQuery.ajax({ - url: pragma_url, - type: 'POST', - dataType: 'json', - headers: { }, - data: JSON.stringify(annotation), - processData: false, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - if (typeof successCallback === "function") { - successCallback(annotation) - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - } - } - - - $.PragmaEndpoint = function(options) { - - jQuery.extend(this, { - dfd: null, - annotationsList: [], //OA list for Mirador use - windowID: null, - eventEmitter: null - }, options); - - this.init(); - }; - - $.PragmaEndpoint.prototype = { - init: function() { - //whatever initialization your endpoint needs - }, - - //Search endpoint for all annotations with a given URI in options - search: function(options, successCallback, errorCallback) { - var _this = this; - - //use options.uri - jQuery.ajax({ - url: pragma_url + '?canvas_id=' + options.uri, - type: 'GET', - dataType: 'json', - headers: { }, - data: { - canvas_id: options.uri - }, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotations = data.annotations - _this.annotationsList = []; - - jQuery.each(annotations, function(index, value) { - value.annotation.on = [value.annotation.on]; - value.annotation.endpoint = _this; - if (!value.annotation['@id']) { - value.annotation['@id'] = $.genUUID(); - } - - _this.annotationsList.push(value.annotation); - }); - - //check if a function has been passed in, otherwise, treat it as a normal search - if (typeof successCallback === "function") { - successCallback(_this.annotationsList); - } else { - _this.dfd.resolve(true); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - //Delete an annotation by endpoint identifier - deleteAnnotation: function(annotationID, successCallback, errorCallback) { - var _this = this; - jQuery.ajax({ - url: pragma_url, - type: 'DELETE', - dataType: 'json', - headers: { }, - contentType: "application/json; charset=utf-8", - success: function(data) { - if (typeof successCallback === "function") { - successCallback(); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - //Update an annotation given the OA version - update: function(oaAnnotation, successCallback, errorCallback) { - var _this = this; - - Annotation.update(oaAnnotation, function(annotation) { - if (typeof successCallback === "function") { - annotation.endpoint = _this; - successCallback(_this.getAnnotationInOA(annotation)); - } - }, errorCallback); - - }, - - //takes OA Annotation, gets Endpoint Annotation, and saves - //if successful, MUST return the OA rendering of the annotation - create: function(oaAnnotation, successCallback, errorCallback) { - var _this = this; - oaAnnotation.on = oaAnnotation.on[0]; - jQuery.ajax({ - url: pragma_url, - type: 'POST', - dataType: 'json', - headers: { }, - data: JSON.stringify(oaAnnotation), - processData: false, - contentType: "application/json; charset=utf-8", - success: function(data) { - var annotation = data.annotation; - annotation.endpoint = _this; - if (typeof successCallback === "function") { - successCallback(_this.getAnnotationInOA(annotation)); - } - }, - error: function() { - if (typeof errorCallback === "function") { - errorCallback(); - } - } - }); - }, - - userAuthorize: function(){ - return true; - }, - - set: function(prop, value, options) { - if (options) { - this[options.parent][prop] = value; - } else { - this[prop] = value; - } - }, - - //Convert Endpoint annotation to OA - getAnnotationInOA: function(annotation) { - annotation.on = [annotation.on]; - return annotation; - }, - - // Converts OA Annotation to endpoint format - getAnnotationInEndpoint: function(oaAnnotation) { - return oaAnnotation; - } - }; -}(Mirador)); diff --git a/iiify/static/mirador-2.1/js/app.js b/iiify/static/mirador-2.1/js/app.js deleted file mode 100644 index 349504a..0000000 --- a/iiify/static/mirador-2.1/js/app.js +++ /dev/null @@ -1,24 +0,0 @@ -var mirador; -$(document).ready(function() { - mirador = Mirador({ - "id": "viewer", - "layout": "1x1", - "data": [{ - "manifestUri": "https://iiif.archivelab.org/iiif/TheGeometry/manifest.json", "location": "Internet Archive" - }], - "windowObjects": [{ - "viewType": "ImageView", - "loadedManifest": "https://iiif.archivelab.org/iiif/TheGeometry/manifest.json", - "annotationLayer": true, - "annotationCreation": true, - "annotationState": 'on' - }], - "annotationEndpoint": { - - "name": "Local Storage", - "module": "PragmaEndpoint" - - } - }); - crosslink.setup(mirador); -}); diff --git a/iiify/static/mirador-2.1/js/crosslink.js b/iiify/static/mirador-2.1/js/crosslink.js deleted file mode 100644 index bd02e62..0000000 --- a/iiify/static/mirador-2.1/js/crosslink.js +++ /dev/null @@ -1,158 +0,0 @@ -var crosslink; -var loaded = false; -$(document).ready(function() { - crosslink = { - setup: function(mirador) { - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - if (!loaded) { - $('.mirador-main-menu').prepend( - '
  • xAnnotate
  • '); - $('.mirador-main-menu').prepend('
    '); - loaded = true; - } - }); - - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - - var isManifestLoaded = function(manifestUri) { - for (var m in mirador.viewer.data) { - if (mirador.viewer.data[m].manifestUri == manifestUri) { - return true; - } - } - return false; - } - - var splitAndLoad = function(manifest, canvas) { - mirador.viewer.eventEmitter.publish('SPLIT_RIGHT', mirador.viewer.workspace.slots[0]); - console.log(manifest) - var _config = { - manifest: manifest, - slotAddress: mirador.viewer.workspace.slots[1].getAddress(), - canvasID: canvas, - viewType: 'ImageView', - annotationLayer: true, - annotationCreation: true, - annotationState: 'on' - }; - mirador.reload(); - mirador.viewer.eventEmitter.publish('ADD_WINDOW', _config); - // load the manifest in the right slot - } - - mirador.reload = function() { - for (var i in mirador.viewer.workspace.windows) { - var window = mirador.viewer.workspace.windows[i]; - window.update(); - } - } - - $('.mirador-viewer').on('click', '.text-viewer a', function(event) { - var link = $(this).attr('href'), - canvas, - manifest; - - event.preventDefault(); - event.stopImmediatePropagation; - - $.get(link, function(anno) { - canvas = anno.annotation.on.full; - manifest = anno.annotation.on.within['@id']; - - // XXX this is breaking if manifest is the same - // check if manifest loadad - - - if (isManifestLoaded(manifest)) { - splitAndLoad(manifest, canvas); - } else { - mirador.viewer.addManifestFromUrl(manifest); - } - }); - mirador.viewer.eventEmitter.subscribe('manifestReceived', function(event, manifest) { - splitAndLoad(manifest, canvas); - }); - - return false; - }); - - }); - } - } - - var insertCrosslinks = function(source_id, target_id, link_text) { - var hyperlink = function(annotation_id) { - return '

    ' + link_text + '

    '; - } - - console.log('attempting crosslink'); - console.log('fetching target:'); - Annotation.get(target_id, function(target_annotation) { - target_annotation.resource[0]['chars'] += hyperlink(source_id); - console.log('target, before update:'); - console.log(target_annotation); - Annotation.update(target_annotation, function(x) { - console.log('updated target:'); - console.log(x); - console.log('fetching source:'); - Annotation.get(source_id, function(source_annotation) { - console.log('source, before update:'); - console.log(source_annotation); - source_annotation.resource[0]['chars'] += hyperlink(target_id); - Annotation.update(source_annotation, function(y) { - console.log('updated source:'); - console.log(y); - //mirador.reload(); - }); - }); - }); - }); - } - - $(document).on('click', '#xannotate-submit', function(e) { - var source_annotation_id = $('.xannotate-source').val(); - var target_annotation_id = $('.xannotate-target').val(); - var link_text = $('.xannotate-text').val(); - insertCrosslinks(source_annotation_id, target_annotation_id, link_text); - e.stopImmediatePropagation(); - e.preventDefault(); - return false; - }); - - $(document).on('click', '.xannotate-activate', function() { - $('.xannotate-widget').toggle(); - }); - - $('.button-container').append( - '' + - 'crosslink'); - - $(document).on('click', '.annotation-tooltip', function(e) { - var anno_id = $(this).data('anno-id'); - console.log(anno_id); - if (anno_id) { - if (!$('.xannotate-source').val()) { - $('.xannotate-source').val(anno_id); - } else { - $('.xannotate-target').val(anno_id); - } - } - }); - - $('.xannotate-widget .xannotate-source').focus(function(e) { - $('.xannotate-target').removeClass('selected'); - $('.xannotate-source').addClass('selected'); - // change mouse cursor to crosshairs - }) - - $('.xannotate-widget .xannotate-target').focus(function(e) { - $('.xannotate-source').removeClass('selected'); - $('.xannotate-target').addClass('selected'); - // change mouse cursor to crosshairs - }); - - $(document).click(function() { - var selected = $('.xannotate-widget .selected'); - }); - -}); From ec62a796668704ba3252171bc0fe9699665f54c4 Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Thu, 5 Oct 2023 17:09:39 -0400 Subject: [PATCH 2/9] Push test fix --- tests/test_manifests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 2ffdc76..5f23a1e 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -17,7 +17,7 @@ def test_ident(self): resp = self.test_app.get("/iiif/3/img-8664_202009/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json - self.assertEqual(manifest['id'], 'http://localhost/iiif/3/img-8664_202009/manifest.json', 'Unexpected identifier') + self.assertEqual(manifest['id'], 'https://localhost/iiif/img-8664_202009/manifest.json', 'Unexpected identifier') def test_v3_image_manifest(self): resp = self.test_app.get("/iiif/3/rashodgson68/manifest.json") From d1d58c7f1fb8759b93f3d175d0e9aa7b2411c384 Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Tue, 17 Oct 2023 15:44:50 -0400 Subject: [PATCH 3/9] Add tests --- tests/test_manifests.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 5f23a1e..e693f22 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -7,7 +7,6 @@ class TestManifests(unittest.TestCase): def setUp(self) -> None: self.test_app = FlaskClient(app) - def test_no_version(self): resp = self.test_app.get("/iiif/rashodgson68/manifest.json") self.assertEqual(resp.status_code, 302) @@ -104,6 +103,33 @@ def test_provider_logo(self): self.assertEqual(manifest['provider'][0]['homepage'][0]['id'] == "https://archive.org", True, f"Expected 'https://archive.org' but got {manifest['provider'][0]['id']}") self.assertEqual(manifest['provider'][0]['logo'][0]['id'] == "https://archive.org/images/glogo.png", True, f"Expected logo URI but got {manifest['provider'][0]['logo'][0]['id']}") + def escape_cantaloupe_urls(self): + resp = self.test_app.get("/iiif/3/0-._20211206/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + + def escape_cantaloupe_urls1(self): + resp = self.test_app.get("/iiif/3/mareful/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + + def escape_cantaloupe_urls2(self): + resp = self.test_app.get("/iiif/3/balagzone_gmail/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + + def metadata_array(self): + resp = self.test_app.get("/iiif/3/annualreport00carn_14/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['summary']['none'][0], "Report year ends Sept. 30", f"Expected a value of 'Report year ends Sept. 30' but got {manifest['summary']['none'][0]}") + self.assertEqual(manifest['summary']['none'][1], "1951-71. 1 v", f"Expected a value of '1951-71. 1 v' but got {manifest['summary']['none'][1]}") + + + ''' to test: kaled_jalil (no derivatives) Dokku_obrash (geo-restricted?) From fb9f54a8b3a7ed319cc938224a51a3293c7a71e9 Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Tue, 17 Oct 2023 15:45:15 -0400 Subject: [PATCH 4/9] Fix cicd URL --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index d93c06e..a36c8f7 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -25,7 +25,7 @@ jobs: deploy: environment: name: development - url: https://archivelabs-iiif-archivelab-org-${{ env.BRANCH_NAME }}.ux-fnf-misc.archive.org + url: https://internetarchive-iiif-${{ env.BRANCH_NAME }}.ux-fnf-misc.archive.org runs-on: ubuntu-latest needs: cicd steps: From c4644f7a6f9c88eefc2a5a410c275146ce29682a Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Tue, 17 Oct 2023 15:54:00 -0400 Subject: [PATCH 5/9] Fix tests --- tests/test_manifests.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index e693f22..912997a 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -104,22 +104,22 @@ def test_provider_logo(self): self.assertEqual(manifest['provider'][0]['logo'][0]['id'] == "https://archive.org/images/glogo.png", True, f"Expected logo URI but got {manifest['provider'][0]['logo'][0]['id']}") def escape_cantaloupe_urls(self): - resp = self.test_app.get("/iiif/3/0-._20211206/manifest.json") - self.assertEqual(resp.status_code, 200) - manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") - - def escape_cantaloupe_urls1(self): - resp = self.test_app.get("/iiif/3/mareful/manifest.json") - self.assertEqual(resp.status_code, 200) - manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") - - def escape_cantaloupe_urls2(self): - resp = self.test_app.get("/iiif/3/balagzone_gmail/manifest.json") - self.assertEqual(resp.status_code, 200) - manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + resp = self.test_app.get("/iiif/3/0-._20211206/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + + def escape_cantaloupe_urls_one(self): + resp = self.test_app.get("/iiif/3/mareful/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + + def escape_cantaloupe_urls_two(self): + resp = self.test_app.get("/iiif/3/balagzone_gmail/manifest.json") + self.assertEqual(resp.status_code, 200) + manifest = resp.json + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") def metadata_array(self): resp = self.test_app.get("/iiif/3/annualreport00carn_14/manifest.json") From 0fbe0fd7087c9911fba8709954a76e6917fd105a Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Tue, 17 Oct 2023 17:11:49 -0400 Subject: [PATCH 6/9] Fix tests --- tests/test_manifests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 912997a..5a0457a 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -103,25 +103,25 @@ def test_provider_logo(self): self.assertEqual(manifest['provider'][0]['homepage'][0]['id'] == "https://archive.org", True, f"Expected 'https://archive.org' but got {manifest['provider'][0]['id']}") self.assertEqual(manifest['provider'][0]['logo'][0]['id'] == "https://archive.org/images/glogo.png", True, f"Expected logo URI but got {manifest['provider'][0]['logo'][0]['id']}") - def escape_cantaloupe_urls(self): + def test_escape_cantaloupe_urls(self): resp = self.test_app.get("/iiif/3/0-._20211206/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2",True, f"Expected 'https://iiif.archive.org/image/iiif/3/0-._20211206%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2.zip%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_jp2%2F%D8%AF%D8%B1%D8%A7%D8%B3%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D9%81%D9%84%D9%83%D9%84%D9%88%D8%B1%20%D8%A7%D9%84%D8%B3%D9%88%D8%AF%D8%A7%D9%86%D9%8A%200%20%D8%AF.%D9%86%D8%B5%D8%B1%D8%A7%D9%84%D8%AF%D9%8A%D9%86%20%D8%B3%D9%84%D9%8A%D9%85%D8%A7%D9%86_0000.jp2' but got {manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") - def escape_cantaloupe_urls_one(self): + def test_escape_cantaloupe_urls_one(self): resp = self.test_app.get("/iiif/3/mareful/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2",True, f"Expected 'https://iiif.archive.org/image/iiif/3/new%2Fmareful-quran-08-new-edition_jp2.zip%2Fmareful-quran-08-new-edition_jp2%2Fmareful-quran-08-new-edition_0000.jp2' but got {manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") - def escape_cantaloupe_urls_two(self): + def test_escape_cantaloupe_urls_two(self): resp = self.test_app.get("/iiif/3/balagzone_gmail/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json - self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json",True, f"Expected 'https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2/info.json' but got {['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") + self.assertEqual(manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id'] == "https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2",True, f"Expected 'https://iiif.archive.org/image/iiif/3/balagzone_gmail%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2.zip%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_jp2%2F%E0%AE%95%E0%AE%A3%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%A4%E0%AE%BF%E0%AE%95%E0%AE%BE%E0%AE%B0%E0%AE%AE%E0%AF%8D-%20%E0%AE%AE%E0%AF%81%E0%AE%B4%E0%AF%81%20%E0%AE%A8%E0%AF%82%E0%AE%B2%E0%AF%8D_0000.jp2' but got {manifest['items'][0]['items'][0]['items'][0]['body']['service'][0]['id']}") - def metadata_array(self): + def test_metadata_array(self): resp = self.test_app.get("/iiif/3/annualreport00carn_14/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json From d9b4a7c47525a5e0825a3764afc0295ba1335f79 Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Wed, 18 Oct 2023 10:53:30 -0400 Subject: [PATCH 7/9] Add collections tests --- tests/test_collections.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_collections.py b/tests/test_collections.py index 24038a5..23d79d9 100644 --- a/tests/test_collections.py +++ b/tests/test_collections.py @@ -16,6 +16,21 @@ def test_v3_collection(self): self.assertEqual(len(collection['items']),1001,f"Expected 1001 items but got: {len(collection['items'])}") self.assertEqual(collection['items'][-1]['type'],'Collection',"Expected last item to be a collection pointing to the next set of results") + def test_v3_collection_pages(self): + resp = self.test_app.get("/iiif/3/frankbford/2/collection.json") + self.assertEqual(resp.status_code, 200) + + def test_collections_redirect(self): + resp = self.test_app.get("/iiif/frankbford/collection.json") + self.assertEqual(resp.status_code, 302) + + def test_v3_collection_pages_redirect(self): + resp = self.test_app.get("/iiif/frankbford/2/collection.json") + self.assertEqual(resp.status_code, 302) + +def test_v3_collection_detection(self): + resp = self.test_app.get("/iiif/frankbford/manifest.json") + self.assertEqual(resp.status_code, 302) if __name__ == '__main__': unittest.main() \ No newline at end of file From e50c01bc1fef0aded1511ab825f65d97858f801c Mon Sep 17 00:00:00 2001 From: Josh Hadro Date: Wed, 18 Oct 2023 10:53:43 -0400 Subject: [PATCH 8/9] Fix metadata array test --- tests/test_manifests.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 5a0457a..fa8ef9b 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -125,9 +125,7 @@ def test_metadata_array(self): resp = self.test_app.get("/iiif/3/annualreport00carn_14/manifest.json") self.assertEqual(resp.status_code, 200) manifest = resp.json - self.assertEqual(manifest['summary']['none'][0], "Report year ends Sept. 30", f"Expected a value of 'Report year ends Sept. 30' but got {manifest['summary']['none'][0]}") - self.assertEqual(manifest['summary']['none'][1], "1951-71. 1 v", f"Expected a value of '1951-71. 1 v' but got {manifest['summary']['none'][1]}") - + self.assertTrue(len(manifest['summary']['none']) > 1, f"Expected multiple summary values, but got {manifest['summary']['none']}") ''' to test: From 78469cf6dda525bae1eb87421d6d5d8f26b6c28e Mon Sep 17 00:00:00 2001 From: Mike Bennett <93522067+digitaldogsbody@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:08:51 +0100 Subject: [PATCH 9/9] Delete group.nomad - as per Rob in Slack (temporary?) --- group.nomad | 422 ---------------------------------------------------- 1 file changed, 422 deletions(-) delete mode 100644 group.nomad diff --git a/group.nomad b/group.nomad deleted file mode 100644 index 41cf78d..0000000 --- a/group.nomad +++ /dev/null @@ -1,422 +0,0 @@ -task "cantaloupe" { - driver = "docker" - - lifecycle { - hook = "prestart" - sidecar = true - } - - config { - image = "uclalibrary/cantaloupe:5.0.5-7" - ports = [ "cantaloupe" ] - mount { - type = "bind" - target = "/etc/cantaloupe/cantaloupe.properties" - source = "local/cantaloupe.properties" - readonly = true - bind_options { - propagation = "rshared" - } - } - } - - template { -data = <