Made the license notice a bit shorter in source code. Left the long version in script...
[librarian.git] / tests / test_html.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright © 2008,2009,2010 Fundacja Nowoczesna Polska  
4 #
5 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
6 # For full license text see COPYING or <http://www.gnu.org/licenses/agpl.html>
7 #
8 from librarian import html, NoDublinCore
9 from nose.tools import *
10 from utils import get_fixture, remove_output_file
11
12 def teardown_transform():
13     remove_output_file('text', 'asnyk_miedzy_nami.html')
14
15
16 @with_setup(None, teardown_transform)
17 def test_transform():
18     output_file_path = get_fixture('text', 'asnyk_miedzy_nami.html')
19     expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.html')
20     
21     html.transform(
22         get_fixture('text', 'asnyk_miedzy_nami.xml'),
23         output_file_path,
24     )
25     
26     assert_equal(file(output_file_path).read(), file(expected_output_file_path).read())
27
28
29 @with_setup(None, teardown_transform)
30 @raises(NoDublinCore)
31 def test_no_dublincore():
32     html.transform(
33         get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
34         get_fixture('text', 'asnyk_miedzy_nami_nodc.html'),
35     )
36
37
38 @with_setup(None, teardown_transform)
39 def test_passing_parse_dublincore_to_transform():
40     """Passing parse_dublincore=False to transform omits DublinCore parsing."""
41     html.transform(
42         get_fixture('text', 'asnyk_miedzy_nami_nodc.xml'),
43         get_fixture('text', 'asnyk_miedzy_nami.html'),
44         parse_dublincore=False,
45     )