diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-07-02 23:23:22 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-07-02 23:44:10 +0200 |
commit | 0f37d6d5576544a90f9dc4afd9a2efc187eceeaa (patch) | |
tree | ef2c63837ec3d01d17526a8810f6a9ae531c1b5b /tests | |
parent | 8f2166eb9658b939ed054899db6e95039750f1f2 (diff) | |
download | clufter-0f37d6d5576544a90f9dc4afd9a2efc187eceeaa.tar.gz clufter-0f37d6d5576544a90f9dc4afd9a2efc187eceeaa.tar.xz clufter-0f37d6d5576544a90f9dc4afd9a2efc187eceeaa.zip |
filters/simpleconfig2needlexml: implemented + unit test
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/filters/simpleconfig2needlexml.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/filters/simpleconfig2needlexml.py b/tests/filters/simpleconfig2needlexml.py new file mode 100644 index 0000000..40d2cda --- /dev/null +++ b/tests/filters/simpleconfig2needlexml.py @@ -0,0 +1,50 @@ +# -*- coding: UTF-8 -*- +# Copyright 2015 Red Hat, Inc. +# Part of clufter project +# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) +"""Testing `simpleconfig2needlexml' filter""" +__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" + +from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go')) + + +from os.path import dirname, join +from unittest import TestCase + +from .filter_manager import FilterManager +from .formats.simpleconfig import simpleconfig + +flt = 'simpleconfig2needlexml' +simpleconfig2needlexml = FilterManager.init_lookup(flt).filters[flt] + + +class FiltersSimpleconfig2NeedlexmlTestCase(TestCase): + def testSimpleconfig2Needlexml(self): + result = simpleconfig2needlexml(simpleconfig('struct', + ('corosync-ONLY-INTERNAL-TAG-NOT-EXTERNALIZED-ANYWAY', + [], + [('totem', [('version', '2'), ('cluster_name', 'aus-cluster')], {}), + ('nodelist', + [], + [('node', [('nodeid', '1'), ('ring0_addr', 'lolek.example.com')], []), + ('node', [('nodeid', '2'), ('ring0_addr', 'bolek.example.com')], [])]), + ('quorum', + [('provider', 'corosync_votequorum'), + ('expected_votes', '1'), + ('two_node', '1')], + [])]) + )) + #print result.BYTESTRING() + self.assertEquals(result.BYTESTRING(), """\ +<corosync> + <totem version="2" cluster_name="aus-cluster"/> + <nodelist> + <node nodeid="1" ring0_addr="lolek.example.com"/> + <node nodeid="2" ring0_addr="bolek.example.com"/> + </nodelist> + <quorum provider="corosync_votequorum" expected_votes="1" two_node="1"/> +</corosync> +""") + + +from os.path import join, dirname as d; execfile(join(d(d(__file__)), '_gone')) |