202acdd65e75804fd4675437012b48252525c13e
[wolnelektury.git] / apps / picture / tests / picture_import.py
1 # -*- coding: utf-8 -*-
2 from __future__ import with_statement
3
4 from os import path
5 from django.test import TestCase
6 from picture.models import Picture
7
8
9 class PictureTest(TestCase):
10     
11     def test_import(self):
12         picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"))
13
14         motifs = set([tag.name for tag in picture.tags if tag.category == 'theme'])
15         assert motifs == set([u'nieporządek']), 'theme tags are wrong. %s' % motifs
16
17         picture.delete()
18
19     def test_import_with_explicit_image(self):
20         picture = Picture.from_xml_file(path.join(path.dirname(__file__), "files/kandinsky-composition-viii.xml"),
21                                         path.join(path.dirname(__file__), "files/kandinsky-composition-viii.png"))
22
23         picture.delete()
24