mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
111: Minor changes to mthd and prop classes; updated mthd and prop unit tests
This commit is contained in:
parent
9282418291
commit
c1a125256b
@ -136,7 +136,6 @@ class cmd(plugable.Plugin):
|
||||
'__call__',
|
||||
'get_doc',
|
||||
'options',
|
||||
|
||||
))
|
||||
__options = None
|
||||
option_classes = tuple()
|
||||
@ -248,6 +247,10 @@ class obj(plugable.Plugin):
|
||||
|
||||
|
||||
class attr(plugable.Plugin):
|
||||
__public__ = frozenset((
|
||||
'obj',
|
||||
'obj_name',
|
||||
))
|
||||
__obj = None
|
||||
|
||||
def __init__(self):
|
||||
@ -278,17 +281,18 @@ class attr(plugable.Plugin):
|
||||
|
||||
|
||||
class mthd(attr, cmd):
|
||||
__public__ = frozenset((
|
||||
'obj',
|
||||
'obj_name',
|
||||
))
|
||||
__public__ = attr.__public__.union(cmd.__public__)
|
||||
|
||||
def get_options(self):
|
||||
for proxy in cmd.get_options(self):
|
||||
yield proxy
|
||||
if self.obj is not None and self.obj.prop is not None:
|
||||
for proxy in self.obj.prop:
|
||||
yield proxy
|
||||
|
||||
|
||||
class prop(attr):
|
||||
__public__ = frozenset((
|
||||
'obj',
|
||||
'obj_name',
|
||||
))
|
||||
class prop(attr, option):
|
||||
__public__ = attr.__public__.union(option.__public__)
|
||||
|
||||
def get_doc(self, _):
|
||||
return _('prop doc')
|
||||
|
@ -300,15 +300,24 @@ def test_attr():
|
||||
assert read_only(i, 'obj') == 'the user obj'
|
||||
|
||||
|
||||
def test_mthd():
|
||||
cls = public.mthd
|
||||
assert issubclass(cls, public.attr)
|
||||
assert issubclass(cls, public.cmd)
|
||||
class test_mthd(ClassChecker):
|
||||
"""
|
||||
Tests the `mthd` class.
|
||||
"""
|
||||
_cls = public.mthd
|
||||
|
||||
def test_class(self):
|
||||
assert self.cls.__bases__ == (public.attr, public.cmd)
|
||||
assert self.cls.implements(public.cmd)
|
||||
|
||||
|
||||
def test_prop():
|
||||
cls = public.prop
|
||||
assert issubclass(cls, public.attr)
|
||||
class test_prop(ClassChecker):
|
||||
_cls = public.prop
|
||||
|
||||
def test_class(self):
|
||||
assert self.cls.__bases__ == (public.attr, public.option)
|
||||
assert self.cls.implements(public.option)
|
||||
|
||||
|
||||
|
||||
def test_PublicAPI():
|
||||
|
Loading…
Reference in New Issue
Block a user