1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from __future__ import with_statement
8 from picture.models import Picture
9 from catalogue.test_utils import WLTestCase
12 class PictureTest(WLTestCase):
14 def test_import(self):
15 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"))
17 motifs = set([tag.name for tag in picture.tags if tag.category == 'theme'])
18 assert motifs == set([u'nieporządek']), 'theme tags are wrong. %s' % motifs
22 def test_import_with_explicit_image(self):
23 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"),
24 path.join(path.dirname(__file__), "files/kandinsky-composition-viii.png"))
29 def test_import_2(self):
30 picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/pejzaz-i-miasto-krzyzanowski-chmury.xml"),
31 path.join(path.dirname(__file__), "files/pejzaz-i-miasto-krzyzanowski-chmury.jpg"),
33 cats = set([t.category for t in picture.tags])
34 assert 'genre' in cats