summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-09-13 16:08:22 +0200
committerPetr Viktorin <pviktori@redhat.com>2014-02-12 17:11:17 +0100
commiteb14f99ece71170758399c16bee5b07a866f3775 (patch)
tree140b23bb82a8555840937cdc83b97584c5f6236e /ipatests/test_xmlrpc
parent2f3ab2914a2522ab97b455d83b809530dac37f04 (diff)
downloadfreeipa-eb14f99ece71170758399c16bee5b07a866f3775.tar.gz
freeipa-eb14f99ece71170758399c16bee5b07a866f3775.tar.xz
freeipa-eb14f99ece71170758399c16bee5b07a866f3775.zip
Make it possible to call custom functions in Declarative tests
Sometimes, we will want to do more than just call IPA commands and check the output. This patch makes it possible to add arbitrary functions to Declarative tests. They will be called as part of the sequence of tests. Reviewed-By: Martin Kosek <mkosek@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc')
-rw-r--r--ipatests/test_xmlrpc/xmlrpc_test.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py
index 21959fbb1..8f31a1ec0 100644
--- a/ipatests/test_xmlrpc/xmlrpc_test.py
+++ b/ipatests/test_xmlrpc/xmlrpc_test.py
@@ -278,11 +278,18 @@ class Declarative(XMLRPC_test):
# Iterate through the tests:
name = self.__class__.__name__
for (i, test) in enumerate(self.tests):
- nice = '%s[%d]: %s: %s' % (
- name, i, test['command'][0], test.get('desc', '')
- )
- func = lambda: self.check(nice, **test)
- func.description = nice
+ if callable(test):
+ func = lambda: test(self)
+ nice = '%s[%d]: call %s: %s' % (
+ name, i, test.__name__, test.__doc__
+ )
+ func.description = nice
+ else:
+ nice = '%s[%d]: %s: %s' % (
+ name, i, test['command'][0], test.get('desc', '')
+ )
+ func = lambda: self.check(nice, **test)
+ func.description = nice
yield (func,)
# Iterate through post-cleanup: