diff --git a/iiify/app.py b/iiify/app.py index f0799e7..d28956f 100755 --- a/iiify/app.py +++ b/iiify/app.py @@ -105,6 +105,8 @@ def helper(identifier): return render_template('helpers/movies.html', identifier=identifier) elif mediatype == "texts": return render_template('helpers/texts.html', identifier=identifier) + elif mediatype == "collection": + return render_template('helpers/collection.html', identifier=identifier) else: return render_template('helpers/unknown.html', identifier=identifier) diff --git a/iiify/templates/helpers/collection.html b/iiify/templates/helpers/collection.html new file mode 100644 index 0000000..3311349 --- /dev/null +++ b/iiify/templates/helpers/collection.html @@ -0,0 +1,38 @@ + + + + + + IIIF Collection Helper + + + + + + + + + +
+ +
+
+ +

IIIF Collection Helper

+ +

The IA collection page URL is: https://archive.org/details/{{ identifier }}

+ +

The IA identifier is: {{ identifier }}

+ +

The IIIF collection URL is: https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json

+ +

IIIF viewer options

+ + + + diff --git a/tests/test_helper.py b/tests/test_helper.py new file mode 100644 index 0000000..0208411 --- /dev/null +++ b/tests/test_helper.py @@ -0,0 +1,23 @@ +import os +os.environ["FLASK_CACHE_DISABLE"] = "true" + +import unittest +from flask.testing import FlaskClient +from iiify.app import app + +class TestHelper(unittest.TestCase): + + def setUp(self) -> None: + self.test_app = FlaskClient(app) + + def test_single_image(self): + resp = self.test_app.get("/iiif/helper/img-8664_202009/") + self.assertEqual(resp.status_code, 200) + + self.assertIn('Mirador', resp.text, "Couldn't find Mirador link in helper page.") + + def test_collection(self): + resp = self.test_app.get("/iiif/helper/frankbford/") + self.assertEqual(resp.status_code, 200) + + self.assertIn('Mirador', resp.text, "Couldn't find Mirador link in helper page.") \ No newline at end of file