X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/3df78775bc9e2e4d861bc0eaa4deadd354dda518..16554e130cc1a138c2352279f9c9e08d87683997:/tests/test_html_fragments.py diff --git a/tests/test_html_fragments.py b/tests/test_html_fragments.py new file mode 100644 index 0000000..99bb62d --- /dev/null +++ b/tests/test_html_fragments.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# +# This file is part of Librarian, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +from librarian.html import extract_fragments +from nose.tools import * +from utils import get_fixture + + +def test_fragments(): + expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_fragments.html') + + closed_fragments, open_fragments = extract_fragments( + get_fixture('text', 'asnyk_miedzy_nami_expected.html')) + assert not open_fragments + fragments_text = u"\n\n".join(u"%s: %s\n%s" % (f.id, f.themes, f) + for f in closed_fragments.values()) + assert_equal(fragments_text, file(expected_output_file_path).read().decode('utf-8')) +