mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
92: Added ProxyTarget.name property; added corresponding unit tests
This commit is contained in:
parent
e3811f3f45
commit
45201e31c1
@ -76,6 +76,13 @@ class ReadOnly(object):
|
|||||||
class ProxyTarget(ReadOnly):
|
class ProxyTarget(ReadOnly):
|
||||||
__public__ = frozenset()
|
__public__ = frozenset()
|
||||||
|
|
||||||
|
def __get_name(self):
|
||||||
|
"""
|
||||||
|
Convenience property to return the class name.
|
||||||
|
"""
|
||||||
|
return self.__class__.__name__
|
||||||
|
name = property(__get_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def implements(cls, arg):
|
def implements(cls, arg):
|
||||||
assert type(cls.__public__) is frozenset
|
assert type(cls.__public__) is frozenset
|
||||||
|
@ -55,7 +55,7 @@ def test_valid_identifier():
|
|||||||
|
|
||||||
class test_ReadOnly(ClassChecker):
|
class test_ReadOnly(ClassChecker):
|
||||||
"""
|
"""
|
||||||
Test the plugable.ReadOnly class
|
Test the `ReadOnly` class
|
||||||
"""
|
"""
|
||||||
_cls = plugable.ReadOnly
|
_cls = plugable.ReadOnly
|
||||||
|
|
||||||
@ -103,17 +103,28 @@ class test_ReadOnly(ClassChecker):
|
|||||||
|
|
||||||
class test_ProxyTarget(ClassChecker):
|
class test_ProxyTarget(ClassChecker):
|
||||||
"""
|
"""
|
||||||
Test the plugable.ProxyTarget class.
|
Test the `ProxyTarget` class.
|
||||||
"""
|
"""
|
||||||
_cls = plugable.ProxyTarget
|
_cls = plugable.ProxyTarget
|
||||||
|
|
||||||
def test_class(self):
|
def test_class(self):
|
||||||
assert self.cls.__bases__ == (plugable.ReadOnly,)
|
assert self.cls.__bases__ == (plugable.ReadOnly,)
|
||||||
|
assert type(self.cls.name) is property
|
||||||
assert self.cls.implements(frozenset())
|
assert self.cls.implements(frozenset())
|
||||||
|
|
||||||
|
def test_name(self):
|
||||||
|
"""
|
||||||
|
Test the `name` property.
|
||||||
|
"""
|
||||||
|
assert read_only(self.cls(), 'name') == 'ProxyTarget'
|
||||||
|
|
||||||
|
class some_subclass(self.cls):
|
||||||
|
pass
|
||||||
|
assert read_only(some_subclass(), 'name') == 'some_subclass'
|
||||||
|
|
||||||
def test_implements(self):
|
def test_implements(self):
|
||||||
"""
|
"""
|
||||||
Test the implements() classmethod
|
Test the `implements` classmethod.
|
||||||
"""
|
"""
|
||||||
class example(self.cls):
|
class example(self.cls):
|
||||||
__public__ = frozenset((
|
__public__ = frozenset((
|
||||||
|
Loading…
Reference in New Issue
Block a user