diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 01:52:34 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 01:52:34 +0000 |
commit | 9f704e001daf760de92c590f69582fc7ffd0c0f2 (patch) | |
tree | f10f681500e616be1592711956d1bcb74b2046a4 | |
parent | 54c97b494880a3d276e2da69ffde55a3ee475616 (diff) | |
download | freeipa-9f704e001daf760de92c590f69582fc7ffd0c0f2.tar.gz freeipa-9f704e001daf760de92c590f69582fc7ffd0c0f2.tar.xz freeipa-9f704e001daf760de92c590f69582fc7ffd0c0f2.zip |
360: Removed Method.get_options() default implementation; cleaned up unit tests for Method
-rw-r--r-- | ipalib/frontend.py | 7 | ||||
-rw-r--r-- | ipalib/tests/test_frontend.py | 36 |
2 files changed, 12 insertions, 31 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 40220074..5573e944 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -617,13 +617,6 @@ class Method(Attribute, Command): Attribute.__init__(self) Command.__init__(self) - def get_options(self): - for option in self.takes_options: - yield option - if self.obj is not None and self.obj.params is not None: - for param in self.obj.params(): - yield param - class Property(Attribute): __public__ = frozenset(( diff --git a/ipalib/tests/test_frontend.py b/ipalib/tests/test_frontend.py index 38c35506..3f993223 100644 --- a/ipalib/tests/test_frontend.py +++ b/ipalib/tests/test_frontend.py @@ -952,39 +952,27 @@ class test_Attribute(ClassChecker): class test_Method(ClassChecker): """ - Tests the `frontend.Method` class. + Test the `frontend.Method` class. """ _cls = frontend.Method def test_class(self): assert self.cls.__bases__ == (frontend.Attribute, frontend.Command) assert self.cls.implements(frontend.Command) + assert self.cls.implements(frontend.Attribute) - def get_subcls(self): - class example_obj(object): - params = plugable.NameSpace( - frontend.create_param(n) for n in ('prop0', 'prop1') - ) - type_ = ipa_types.Unicode() - class noun_verb(self.cls): - takes_options= ( - frontend.Param('option0', type_), - frontend.Param('option1', type_), - ) - obj = example_obj() - return noun_verb - - def test_get_options(self): + def test_init(self): """ - Tests the `frontend.Method.get_options` method. + Test the `frontend.Method.__init__` method. """ - sub = self.subcls() - names = ('option0', 'option1', 'prop0', 'prop1') - options = tuple(sub.get_options()) - assert len(options) == 4 - for (i, option) in enumerate(options): - assert option.name == names[i] - assert isinstance(option, frontend.Param) + class user_add(self.cls): + pass + o = user_add() + assert o.name == 'user_add' + assert o.obj_name == 'user' + assert o.attr_name == 'add' + assert frontend.Command.implemented_by(o) + assert frontend.Attribute.implemented_by(o) class test_Property(ClassChecker): |