mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Command.output_params not contains params in Command.params
This commit is contained in:
parent
a10dc1e59c
commit
dc2f246d47
@ -810,6 +810,13 @@ class Command(HasParam):
|
||||
def get_output_params(self):
|
||||
for param in self._get_param_iterable('output_params', verb='has'):
|
||||
yield param
|
||||
if self.params is None:
|
||||
return
|
||||
for param in self.params():
|
||||
if 'no_output' in param.flags:
|
||||
continue
|
||||
yield param
|
||||
|
||||
|
||||
def output_for_cli(self, textui, output, *args, **options):
|
||||
if not isinstance(output, dict):
|
||||
|
@ -28,6 +28,7 @@ from ipalib.constants import TYPE_ERROR
|
||||
from ipalib.base import NameSpace
|
||||
from ipalib import frontend, backend, plugable, errors, parameters, config
|
||||
from ipalib import output
|
||||
from ipalib.parameters import Str
|
||||
|
||||
def test_RULE_FLAG():
|
||||
assert frontend.RULE_FLAG == 'validation_rule'
|
||||
@ -654,6 +655,32 @@ class test_Command(ClassChecker):
|
||||
'nested', 'Subclass', 'world', 4, dict, tuple, nope
|
||||
)
|
||||
|
||||
def test_get_output_params(self):
|
||||
"""
|
||||
Test the `ipalib.frontend.Command.get_output_params` method.
|
||||
"""
|
||||
class example(self.cls):
|
||||
has_output_params = (
|
||||
'one',
|
||||
'two',
|
||||
'three',
|
||||
)
|
||||
takes_args = (
|
||||
'foo',
|
||||
)
|
||||
takes_options = (
|
||||
Str('bar', flags='no_output'),
|
||||
'baz',
|
||||
)
|
||||
|
||||
inst = example()
|
||||
assert list(inst.get_output_params()) == ['one', 'two', 'three']
|
||||
inst.finalize()
|
||||
assert list(inst.get_output_params()) == [
|
||||
'one', 'two', 'three', inst.params.foo, inst.params.baz
|
||||
]
|
||||
assert list(inst.output_params) == ['one', 'two', 'three', 'foo', 'baz']
|
||||
|
||||
|
||||
class test_LocalOrRemote(ClassChecker):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user