mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
351: Removed Object.Method property and added in its place Object.methods instance attribute
This commit is contained in:
parent
e2a680d7c9
commit
3d6ab69b46
@ -511,11 +511,11 @@ class Command(plugable.Plugin):
|
|||||||
|
|
||||||
class Object(plugable.Plugin):
|
class Object(plugable.Plugin):
|
||||||
__public__ = frozenset((
|
__public__ = frozenset((
|
||||||
'Method',
|
'methods',
|
||||||
'Property',
|
'Property',
|
||||||
'params'
|
'params'
|
||||||
))
|
))
|
||||||
__Method = None
|
methods = None
|
||||||
__Property = None
|
__Property = None
|
||||||
takes_params = tuple()
|
takes_params = tuple()
|
||||||
|
|
||||||
@ -528,9 +528,6 @@ class Object(plugable.Plugin):
|
|||||||
for param in self.takes_params:
|
for param in self.takes_params:
|
||||||
yield create_param(param)
|
yield create_param(param)
|
||||||
|
|
||||||
def __get_Method(self):
|
|
||||||
return self.__Method
|
|
||||||
Method = property(__get_Method)
|
|
||||||
|
|
||||||
def __get_Property(self):
|
def __get_Property(self):
|
||||||
return self.__Property
|
return self.__Property
|
||||||
@ -538,7 +535,7 @@ class Object(plugable.Plugin):
|
|||||||
|
|
||||||
def set_api(self, api):
|
def set_api(self, api):
|
||||||
super(Object, self).set_api(api)
|
super(Object, self).set_api(api)
|
||||||
self.__Method = self.__create_namespace('Method')
|
self.methods = self.__create_namespace('Method')
|
||||||
self.__Property = self.__create_namespace('Property')
|
self.__Property = self.__create_namespace('Property')
|
||||||
|
|
||||||
def __create_namespace(self, name):
|
def __create_namespace(self, name):
|
||||||
|
@ -760,7 +760,6 @@ class test_Object(ClassChecker):
|
|||||||
|
|
||||||
def test_class(self):
|
def test_class(self):
|
||||||
assert self.cls.__bases__ == (plugable.Plugin,)
|
assert self.cls.__bases__ == (plugable.Plugin,)
|
||||||
assert type(self.cls.Method) is property
|
|
||||||
assert type(self.cls.Property) is property
|
assert type(self.cls.Property) is property
|
||||||
|
|
||||||
def test_init(self):
|
def test_init(self):
|
||||||
@ -768,7 +767,7 @@ class test_Object(ClassChecker):
|
|||||||
Tests the `frontend.Object.__init__` method.
|
Tests the `frontend.Object.__init__` method.
|
||||||
"""
|
"""
|
||||||
o = self.cls()
|
o = self.cls()
|
||||||
assert read_only(o, 'Method') is None
|
assert o.methods is None
|
||||||
assert read_only(o, 'Property') is None
|
assert read_only(o, 'Property') is None
|
||||||
|
|
||||||
def test_set_api(self):
|
def test_set_api(self):
|
||||||
@ -798,13 +797,13 @@ class test_Object(ClassChecker):
|
|||||||
|
|
||||||
cnt = 10
|
cnt = 10
|
||||||
formats = dict(
|
formats = dict(
|
||||||
Method='method_%d',
|
methods='method_%d',
|
||||||
Property='property_%d',
|
Property='property_%d',
|
||||||
)
|
)
|
||||||
|
|
||||||
class api(object):
|
class api(object):
|
||||||
Method = plugable.NameSpace(
|
Method = plugable.NameSpace(
|
||||||
get_attributes(cnt, formats['Method'])
|
get_attributes(cnt, formats['methods'])
|
||||||
)
|
)
|
||||||
Property = plugable.NameSpace(
|
Property = plugable.NameSpace(
|
||||||
get_attributes(cnt, formats['Property'])
|
get_attributes(cnt, formats['Property'])
|
||||||
@ -819,7 +818,7 @@ class test_Object(ClassChecker):
|
|||||||
o = user()
|
o = user()
|
||||||
o.set_api(api)
|
o.set_api(api)
|
||||||
assert read_only(o, 'api') is api
|
assert read_only(o, 'api') is api
|
||||||
for name in ['Method', 'Property']:
|
for name in ['methods', 'Property']:
|
||||||
namespace = getattr(o, name)
|
namespace = getattr(o, name)
|
||||||
assert isinstance(namespace, plugable.NameSpace)
|
assert isinstance(namespace, plugable.NameSpace)
|
||||||
assert len(namespace) == cnt
|
assert len(namespace) == cnt
|
||||||
|
Loading…
Reference in New Issue
Block a user