diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-03-12 05:58:44 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-04-03 16:19:59 -0400 |
commit | 2b077f7b0d68a758ae15a73eeef74591bac84360 (patch) | |
tree | 4d99ffc71065e7bc9a38bd6559f8185e1e936c81 /ipalib/plugins/batch.py | |
parent | b0a5524028cb692d83fafca88ed40794b5c1e86a (diff) | |
download | freeipa-2b077f7b0d68a758ae15a73eeef74591bac84360.tar.gz freeipa-2b077f7b0d68a758ae15a73eeef74591bac84360.tar.xz freeipa-2b077f7b0d68a758ae15a73eeef74591bac84360.zip |
Test the batch plugin
This adds tests for the batch plugin, and changes its output
declaration to allow results as tuples (this tripped validation).
The assert_deepequal function ignores the order of items in lists.
Document this in its docstring, and use a custom checker for the
batch plugin results.
Diffstat (limited to 'ipalib/plugins/batch.py')
-rw-r--r-- | ipalib/plugins/batch.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py index 4c5a6bd1e..8abad5e1e 100644 --- a/ipalib/plugins/batch.py +++ b/ipalib/plugins/batch.py @@ -76,11 +76,11 @@ class batch(Command): has_output = ( Output('count', int, doc=''), - Output('results', list, doc='') + Output('results', (list, tuple), doc='') ) def execute(self, *args, **options): - results=[] + results = [] for arg in args[0]: params = dict() name = None @@ -92,11 +92,8 @@ class batch(Command): name = arg['method'] if name not in self.Command: raise errors.CommandError(name=name) - a = arg['params'][0] - kw = arg['params'][1] - newkw = {} - for k in kw: - newkw[str(k)] = kw[k] + a, kw = arg['params'] + newkw = dict((str(k), v) for k, v in kw.iteritems()) params = api.Command[name].args_options_2_params(*a, **newkw) result = api.Command[name](*a, **newkw) |