summaryrefslogtreecommitdiffstats
path: root/tests/format.py
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-11-18 11:14:43 +0100
committerJan Pokorný <jpokorny@redhat.com>2013-11-18 11:14:43 +0100
commitb182bb2e0a9266b313112d507e9803e5ef2de387 (patch)
treef348cb4d1b254d2e7fa8cc61a1f82d3b4a2e9e99 /tests/format.py
downloadclufter-b182bb2e0a9266b313112d507e9803e5ef2de387.tar.gz
clufter-b182bb2e0a9266b313112d507e9803e5ef2de387.tar.xz
clufter-b182bb2e0a9266b313112d507e9803e5ef2de387.zip
Initial commit
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests/format.py')
-rw-r--r--tests/format.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/format.py b/tests/format.py
new file mode 100644
index 0000000..ea9a75d
--- /dev/null
+++ b/tests/format.py
@@ -0,0 +1,60 @@
+# -*- coding: UTF-8 -*-
+# Copyright 2013 Red Hat, Inc.
+# Part of clufter project
+# Licensed under GPLv2 (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
+"""Testing filter manager"""
+__author__ = "Jan Pokorný <jpokorny at redhat dot com>"
+
+import unittest
+from os.path import dirname, join
+#from pprint import pprint
+
+import _bootstrap # known W402, required
+
+from clufter.formats.ccs import ccs
+
+WALK_DIR = join(dirname(__file__), 'XMLFormat-walk')
+
+RESULT_WALK_FULL = {
+ 'cluster': ('cluster-full', {
+ 'clusternodes': ('clusternodes-full', {
+ 'clusternode': ('clusternode-full', {
+ })
+ }),
+ 'cman': ('cman-full', {
+ }),
+ 'dlm': ('dlm-full', {
+ }),
+ 'rm': ('rm-full', {
+ 'failoverdomains': ('failoverdomains-full', {
+ 'failoverdomain': ('failoverdomain-full', {
+ })
+ }),
+ 'service': ('service-full', {
+ })
+ })
+ })
+}
+
+RESULT_WALK_SPARSE = {
+ 'failoverdomain': ('failoverdomain-sparse', {
+ }),
+ 'heuristic': ('heuristic-sparse', {
+ })
+}
+
+
+class XMLFormatWalkTestCase(unittest.TestCase):
+ def testWalkFull(self):
+ r = ccs.walk_schema(WALK_DIR, 'full')
+ #pprint(r, width=8) # --> expected
+ self.assertTrue(r == RESULT_WALK_FULL)
+
+ def testWalkSparse(self):
+ r = ccs.walk_schema(WALK_DIR, 'sparse')
+ #pprint(r, width=8) # --> expected
+ self.assertTrue(r == RESULT_WALK_SPARSE)
+
+
+if __name__ == '__main__':
+ unittest.main()