diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-09-02 21:48:33 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-09-02 21:51:38 +0200 |
commit | deca55d9d3ac75ddac437d4e6e9957ac56af221f (patch) | |
tree | 3cacd333212cfb23189b21b1bdb8787c7f114a5f /tests | |
parent | a4af62a8b9465f7b9583686dc849b0cdcfb3346e (diff) | |
download | clufter-deca55d9d3ac75ddac437d4e6e9957ac56af221f.tar.gz clufter-deca55d9d3ac75ddac437d4e6e9957ac56af221f.tar.xz clufter-deca55d9d3ac75ddac437d4e6e9957ac56af221f.zip |
command{,_manager}: command responsible for resolving self
... against the passed filters;
The convention is that when the Command{,Alias} cannot be resolved
successfully, None object is returned from constructing the object.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/command.py | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/tests/command.py b/tests/command.py index bf3ead4..2019dfa 100644 --- a/tests/command.py +++ b/tests/command.py @@ -22,9 +22,6 @@ from clufter.formats.ccs import ccs, flatccs from clufter.formats.coro import coroxml from clufter.formats.pcs import pcs -from clufter.utils_func import apply_preserving_depth, \ - apply_aggregation_preserving_depth - class ChainResolve(unittest.TestCase): def testShapeAndProtocolMatch(self): @@ -112,27 +109,22 @@ class ChainResolve(unittest.TestCase): ) split = cmd_classes.index(cmd_chain_nonmatch_01) for i, cmd_cls in enumerate(cmd_classes): - res_input = cmd_cls.filter_chain - res_output = apply_preserving_depth(filters.get)(res_input) - if apply_aggregation_preserving_depth(all)(res_output): - #log.debug("resolve at `{0}' command: `{1}' -> {2}" - # .format(cmd_cls.name, repr(res_input), repr(res_output))) - try: - cmd_cls(*res_output)({}, []) # no args/kwargs - except CommandError as e: - print "{0}: {1}".format(cmd_cls.name, e) - self.assertFalse(i < split) - except Exception as e: - print "{0}: {1}".format(cmd_cls.name, e) - self.assertTrue(i < split) - raise - else: - self.assertTrue(i < split) - # also test non-zero-size output whe - self.assertTrue(stat(testoutput).st_size > 0) - remove(testoutput) - continue - self.assertTrue(False) + try: + ret = cmd_cls(filters)({}, []) # no args/kwargs + self.assertTrue(ret is not None) + except CommandError as e: + print "{0}: {1}".format(cmd_cls.name, e) + self.assertFalse(i < split) + except Exception as e: + print "{0}: {1}".format(cmd_cls.name, e) + self.assertTrue(i < split) + raise + else: + self.assertTrue(i < split) + # also test non-zero-size output whe + self.assertTrue(stat(testoutput).st_size > 0) + remove(testoutput) + continue if __name__ == '__main__': |