Django 3
[redakcja.git] / src / cover / tests.py
1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.test import TestCase
5 from cover.forms import FlickrForm
6
7
8 class FlickrTests(TestCase):
9     def test_flickr(self):
10         form = FlickrForm({"source_url": "https://www.flickr.com/photos/rczajka/6941928577/in/photostream"})
11         self.assertTrue(form.is_valid())
12         self.assertEqual(form.cleaned_data['source_url'], "https://www.flickr.com/photos/rczajka/6941928577/")
13         self.assertEqual(form.cleaned_data['author'], "Radek Czajka@Flickr")
14         self.assertEqual(form.cleaned_data['title'], u"Pirate Stańczyk")
15         self.assertEqual(form.cleaned_data['license_name'], "CC BY 2.0")
16         self.assertEqual(form.cleaned_data['license_url'], "https://creativecommons.org/licenses/by/2.0/")
17         self.assertTrue('.staticflickr.com' in form.cleaned_data['download_url'])