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