summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/frontend.py15
-rw-r--r--ipatests/test_ipalib/test_frontend.py29
2 files changed, 1 insertions, 43 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 341eedc5b..936757a59 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -35,7 +35,7 @@ from ipalib.parameters import Password # pylint: disable=unused-import
from ipalib.output import Output, Entry, ListOfEntries
from ipalib.text import _
from ipalib.errors import (ZeroArgumentError, MaxArgumentError, OverlapError,
- VersionError, OptionError, InvocationError,
+ VersionError, OptionError,
ValidationError, ConversionError)
from ipalib import errors, messages
from ipalib.request import context, context_frame
@@ -467,19 +467,6 @@ class Command(HasParam):
def add_message(self, message):
self.context.__messages.append(message)
- def soft_validate(self, values):
- errors = dict()
- for p in self.params():
- try:
- value = values.get(p.name)
- values[p.name] = p(value, **values)
- except InvocationError as e:
- errors[p.name] = str(e)
- return dict(
- values=values,
- errors=errors,
- )
-
def _repr_iter(self, **params):
"""
Iterate through ``repr()`` of *safe* values of args and options.
diff --git a/ipatests/test_ipalib/test_frontend.py b/ipatests/test_ipalib/test_frontend.py
index a4af5e43c..58ab5f177 100644
--- a/ipatests/test_ipalib/test_frontend.py
+++ b/ipatests/test_ipalib/test_frontend.py
@@ -402,35 +402,6 @@ class test_Command(ClassChecker):
for o in items:
assert type(o) is output.Output
- def test_soft_validate(self):
- """
- Test the `ipalib.frontend.Command.soft_validate` method.
- """
- class api(object):
- env = config.Env(context='cli')
- @staticmethod
- def is_production_mode():
- return False
- class user_add(frontend.Command):
- takes_args = parameters.Str('uid',
- normalizer=lambda value: value.lower(),
- default_from=lambda givenname, sn: givenname[0] + sn,
- )
-
- takes_options = ('givenname', 'sn')
-
- cmd = user_add(api)
- cmd.finalize()
- assert list(cmd.params) == ['givenname', 'sn', 'uid', 'version']
- ret = cmd.soft_validate({})
- assert sorted(ret['values']) == ['version']
- assert sorted(ret['errors']) == ['givenname', 'sn', 'uid']
- assert cmd.soft_validate(dict(givenname=u'First', sn=u'Last')) == dict(
- values=dict(givenname=u'First', sn=u'Last', uid=u'flast',
- version=None),
- errors=dict(),
- )
-
def test_convert(self):
"""
Test the `ipalib.frontend.Command.convert` method.