summaryrefslogtreecommitdiffstats
path: root/tests/utils_xml.py
blob: 60bd780f095175663695aa5de5da0cc1e85814e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: UTF-8 -*-
# Copyright 2014 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Testing XML helpers"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase

from lxml import etree
from os.path import dirname, join

from .utils_xml import rng_pivot


class TestRngPivot(TestCase):
    def test_rng_pivot(self):
        #p = join(dirname_x(__file__, 2), 'formats', 'corosync', 'corosync.rng')
        p = join(dirname(__file__), 'corosync.rng')
        with open(p) as f:
            et = etree.parse(f)
        rng_pivot(et, 'logging')
        p = join(dirname(__file__), 'corosync.rng.exp')
        if False:  # to regenerate the expected file (manual review)
            with open(p, 'w') as f:
                f.write(etree.tostring(et))
        else:
            with open(p) as f:
                expected = f.read()
            self.assertTrue(etree.tostring(et) == expected)


from os.path import join, dirname as d; execfile(join(d(d(__file__)), '_gone'))