Updates
[redakcja.git] / src / cover / tests.py
index 910b0df..09aee19 100644 (file)
@@ -57,7 +57,7 @@ class FlickrTests(TestCase):
                 'title': 'Valdai IverskyMon asv2018 img47',
                 'author': 'A.Savin',
                 'source_url': 'https://commons.wikimedia.org/wiki/File:Valdai_IverskyMon_asv2018_img47.jpg',
                 'title': 'Valdai IverskyMon asv2018 img47',
                 'author': 'A.Savin',
                 'source_url': 'https://commons.wikimedia.org/wiki/File:Valdai_IverskyMon_asv2018_img47.jpg',
-                'download_url': 'https://upload.wikimedia.org/wikipedia/commons/4/43/Valdai_IverskyMon_asv2018_img47.jpg',
+                'download_url': 'https://upload.wikimedia.org/wikipedia/commons/4/43/Valdai_IverskyMon_asv2018_img47.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=original',
                 'license_url': 'http://artlibre.org/licence/lal/en',
                 'license_name': 'FAL'
             }
                 'license_url': 'http://artlibre.org/licence/lal/en',
                 'license_name': 'FAL'
             }
@@ -74,7 +74,7 @@ class FlickrTests(TestCase):
                 'title': 'Chłopiec w słomkowym kapeluszu',
                 'author': 'Mykoła Pymonenko',
                 'source_url': 'https://commons.wikimedia.org/wiki/File:Pymonenko_A_boy_in_a_straw_hat.jpg',
                 'title': 'Chłopiec w słomkowym kapeluszu',
                 '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',
+                'download_url': 'https://upload.wikimedia.org/wikipedia/commons/9/9b/Pymonenko_A_boy_in_a_straw_hat.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=original',
                 'license_url': 'https://pl.wikipedia.org/wiki/Domena_publiczna',
                 'license_name': 'domena publiczna'
             }
                 'license_url': 'https://pl.wikipedia.org/wiki/Domena_publiczna',
                 'license_name': 'domena publiczna'
             }
@@ -104,7 +104,7 @@ class FlickrTests(TestCase):
         book = Book.create(slug='test', text=SAMPLE_XML, creator=user)
         
         self.client.post(
         book = Book.create(slug='test', text=SAMPLE_XML, creator=user)
         
         self.client.post(
-            '/cover/quick-import/1/',
+            f'/cover/quick-import/{book.pk}/',
             {
                 'url': 'https://cyfrowe.mnw.art.pl/pl/zbiory/447973'
             }
             {
                 'url': 'https://cyfrowe.mnw.art.pl/pl/zbiory/447973'
             }
@@ -200,12 +200,12 @@ class TestCover(TestCase):
         self.assertEqual(len(response.context['object_list']), 1)
         
     def test_image(self):
         self.assertEqual(len(response.context['object_list']), 1)
         
     def test_image(self):
-        response = self.client.get('/cover/image/1/')
+        response = self.client.get(f'/cover/image/{self.img.pk}/')
         self.assertEqual(response.context['object'].title, 'Angelus Novus')
 
     def test_edit_image(self):
         self.client.force_login(self.user)
         self.assertEqual(response.context['object'].title, 'Angelus Novus')
 
     def test_edit_image(self):
         self.client.force_login(self.user)
-        response = self.client.post('/cover/image/1/', {
+        response = self.client.post(f'/cover/image/{self.img.pk}/', {
             'author': 'author',
             'title': 'changed title',
             'license_name': 'domena',
             'author': 'author',
             'title': 'changed title',
             'license_name': 'domena',
@@ -215,10 +215,10 @@ class TestCover(TestCase):
             'cut_right': 1,
         })
 
             'cut_right': 1,
         })
 
-        response = self.client.get('/cover/image/1/')
+        response = self.client.get(f'/cover/image/{self.img.pk}/')
         self.assertEqual(response.context['object'].title, 'changed title')
         
         
     def test_image_file(self):
         self.assertEqual(response.context['object'].title, 'changed title')
         
         
     def test_image_file(self):
-        response = self.client.get('/cover/image/1/file/')
+        response = self.client.get(f'/cover/image/{self.img.pk}/file/')
         self.assertRegex(response['Location'], r'^/media/cover/image/')
         self.assertRegex(response['Location'], r'^/media/cover/image/')