From 77538c1274e0e67ddab55e68099df94bc127c0e0 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 19 May 2026 17:30:00 +0200 Subject: [PATCH] fix tests and importers --- src/cover/tests.py | 10 +++++----- src/cover/utils.py | 2 +- src/documents/tests/files/expected.xml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cover/tests.py b/src/cover/tests.py index 4755991e..5436100a 100644 --- a/src/cover/tests.py +++ b/src/cover/tests.py @@ -41,7 +41,7 @@ class FlickrTests(TestCase): 'author': "Radek Czajka@Flickr", 'title': "Pirate Stańczyk", 'license_name': "CC BY 2.0", - 'license_url': "https://creativecommons.org/licenses/by/2.0/", + 'license_url': "https://creativecommons.org/licenses/by/2.0/deed.en", 'download_url': re.compile(r'\.staticflickr\.com'), } ) @@ -72,7 +72,7 @@ class FlickrTests(TestCase): form.cleaned_data, { 'title': 'Chłopiec w słomkowym kapeluszu', - 'author': 'Mykola Pymonenko', + 'author': 'Mykoła Pymonenko', 'source_url': 'https://commons.wikimedia.org/wiki/File:Pymonenko_A_boy_in_a_straw_hat.jpg', 'download_url': 'https://upload.wikimedia.org/wikipedia/commons/9/9b/Pymonenko_A_boy_in_a_straw_hat.jpg', 'license_url': 'https://pl.wikipedia.org/wiki/Domena_publiczna', @@ -82,7 +82,7 @@ class FlickrTests(TestCase): def test_mnw(self): form = ImportForm({ - "source_url": 'https://cyfrowe.mnw.art.pl/pl/katalog/511078' + "source_url": 'https://cyfrowe.mnw.art.pl/pl/zbiory/447973' }) self.assertTrue(form.is_valid()) self.assertEqualWithRe( @@ -90,7 +90,7 @@ class FlickrTests(TestCase): { 'title': 'Chłopka (Baba ukraińska)', 'author': 'Krzyżanowski, Konrad (1872-1922)', - 'source_url': 'https://cyfrowe.mnw.art.pl/pl/katalog/511078', + 'source_url': 'https://cyfrowe.mnw.art.pl/pl/zbiory/447973', 'download_url': re.compile(r'https://cyfrowe-cdn\.mnw\.art\.pl/.*\.jpg'), 'license_url': 'https://pl.wikipedia.org/wiki/Domena_publiczna', 'license_name': 'domena publiczna' @@ -106,7 +106,7 @@ class FlickrTests(TestCase): self.client.post( '/cover/quick-import/1/', { - 'url': 'https://cyfrowe.mnw.art.pl/pl/katalog/511078' + 'url': 'https://cyfrowe.mnw.art.pl/pl/zbiory/447973' } ) diff --git a/src/cover/utils.py b/src/cover/utils.py index baf3e88e..59e194ff 100644 --- a/src/cover/utils.py +++ b/src/cover/utils.py @@ -62,7 +62,7 @@ def get_flickr_data(url): m = re.search(r'modelExport: (\{.*\})', html) try: assert m - download_url = 'https:' + json.loads(m.group(1))['main']['photo-models'][0]['sizes']['o']['url'] + download_url = 'https:' + json.loads(m.group(1))['main']['photo-models'][0]['data']['sizes']['data']['o']['data']['url'] except (AssertionError, ValueError, IndexError, KeyError): raise FlickrError('Error reading image URL.') return { diff --git a/src/documents/tests/files/expected.xml b/src/documents/tests/files/expected.xml index ff225a03..9ea5b5b8 100644 --- a/src/documents/tests/files/expected.xml +++ b/src/documents/tests/files/expected.xml @@ -37,7 +37,7 @@ Precz z mego serca!... i serce posłucha,/ Precz z méj pamięci!... Nie! tego rozkazu/ Moja i twoja pamięć nie posłucha. - + Jak cień tém dłuższy, gdy padnie z daleka,/ Tém szerzéj koło żałobne roztoczy,/ -- 2.20.1