diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-08-27 13:47:51 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-08-27 13:49:19 +0200 |
commit | 8f7f3af271422de4a2160535bed7187faf319b0c (patch) | |
tree | 458f1f591a545b824220aa30988c36931df5cc07 /tests | |
parent | ee3ac4b9f7e773ec73391cd58dfb581ca1d06603 (diff) | |
download | clufter-8f7f3af271422de4a2160535bed7187faf319b0c.tar.gz clufter-8f7f3af271422de4a2160535bed7187faf319b0c.tar.xz clufter-8f7f3af271422de4a2160535bed7187faf319b0c.zip |
tests/run_cmd: new (sanity) test of running a command directly
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run_cmd.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/run_cmd.py b/tests/run_cmd.py new file mode 100644 index 0000000..fdd3166 --- /dev/null +++ b/tests/run_cmd.py @@ -0,0 +1,42 @@ +# -*- 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 direct command run (e.g., when clufter used as a library)""" +__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" + +import unittest +from os.path import dirname, exists, join +from os import unlink +#import logging + +import _bootstrap + +from clufter.command_manager import CommandManager + + +class Main(unittest.TestCase): + def testCcs2PcsNeedle(self): + testfile = join(dirname(__file__), 'filled.conf') + + files = { + "cib": '/tmp/cibcib', + "coro": '/tmp/corocoro', + } + clufter_args = type("cluster_args", (object, ), dict( + input=testfile, + nocheck=True, + batch=True, + **files) + ) + for f in files.itervalues(): + try: + unlink(f) + except OSError: + pass + #logging.basicConfig() + #logging.getLogger("clufter").setLevel(logging.DEBUG) + cmd_manager = CommandManager.implicit() + self.assertFalse(cmd_manager.commands["ccs2pcs-needle"](clufter_args)) + # just the existence of the files is enough for now... + map(lambda f: self.assertTrue(exists(f)), files.itervalues()) |