summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib/test_plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2010-01-27 05:59:09 -0700
committerRob Crittenden <rcritten@redhat.com>2010-01-28 13:32:00 -0500
commit1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f (patch)
treedbd92082b8d84789bd980a689ecc90c37213db67 /tests/test_ipalib/test_plugable.py
parentb7cda86697cfb8ffc25ab5d3c051f181e145648d (diff)
downloadfreeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.tar.gz
freeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.tar.xz
freeipa-1d6cc1bb7b6f4a88f8df23d854993cdef754ec3f.zip
Remove __public__ and __proxy__ hold-overs from Plugin class
Diffstat (limited to 'tests/test_ipalib/test_plugable.py')
-rw-r--r--tests/test_ipalib/test_plugable.py101
1 files changed, 0 insertions, 101 deletions
diff --git a/tests/test_ipalib/test_plugable.py b/tests/test_ipalib/test_plugable.py
index ec1ef3e00..79121cf73 100644
--- a/tests/test_ipalib/test_plugable.py
+++ b/tests/test_ipalib/test_plugable.py
@@ -209,7 +209,6 @@ class test_Plugin(ClassChecker):
Test the `ipalib.plugable.Plugin` class.
"""
assert self.cls.__bases__ == (plugable.ReadOnly,)
- assert self.cls.__public__ == frozenset()
assert type(self.cls.api) is property
def test_init(self):
@@ -251,98 +250,6 @@ class test_Plugin(ClassChecker):
assert str(e) == \
"check.info attribute ('whatever') conflicts with Plugin logger"
- def test_implements(self):
- """
- Test the `ipalib.plugable.Plugin.implements` classmethod.
- """
- class example(self.cls):
- __public__ = frozenset((
- 'some_method',
- 'some_property',
- ))
- class superset(self.cls):
- __public__ = frozenset((
- 'some_method',
- 'some_property',
- 'another_property',
- ))
- class subset(self.cls):
- __public__ = frozenset((
- 'some_property',
- ))
- class any_object(object):
- __public__ = frozenset((
- 'some_method',
- 'some_property',
- ))
-
- for ex in (example, example()):
- # Test using str:
- assert ex.implements('some_method')
- assert not ex.implements('another_method')
-
- # Test using frozenset:
- assert ex.implements(frozenset(['some_method']))
- assert not ex.implements(
- frozenset(['some_method', 'another_method'])
- )
-
- # Test using another object/class with __public__ frozenset:
- assert ex.implements(example)
- assert ex.implements(example())
-
- assert ex.implements(subset)
- assert not subset.implements(ex)
-
- assert not ex.implements(superset)
- assert superset.implements(ex)
-
- assert ex.implements(any_object)
- assert ex.implements(any_object())
-
- def test_implemented_by(self):
- """
- Test the `ipalib.plugable.Plugin.implemented_by` classmethod.
- """
- class base(self.cls):
- __public__ = frozenset((
- 'attr0',
- 'attr1',
- 'attr2',
- ))
-
- class okay(base):
- def attr0(self):
- pass
- def __get_attr1(self):
- assert False # Make sure property isn't accesed on instance
- attr1 = property(__get_attr1)
- attr2 = 'hello world'
- another_attr = 'whatever'
-
- class fail(base):
- def __init__(self):
- # Check that class, not instance is inspected:
- self.attr2 = 'hello world'
- def attr0(self):
- pass
- def __get_attr1(self):
- assert False # Make sure property isn't accesed on instance
- attr1 = property(__get_attr1)
- another_attr = 'whatever'
-
- # Test that AssertionError is raised trying to pass something not
- # subclass nor instance of base:
- raises(AssertionError, base.implemented_by, object)
-
- # Test on subclass with needed attributes:
- assert base.implemented_by(okay) is True
- assert base.implemented_by(okay()) is True
-
- # Test on subclass *without* needed attributes:
- assert base.implemented_by(fail) is False
- assert base.implemented_by(fail()) is False
-
def test_set_api(self):
"""
Test the `ipalib.plugable.Plugin.set_api` method.
@@ -507,18 +414,10 @@ class test_API(ClassChecker):
# Setup the test bases, create the API:
class base0(plugable.Plugin):
- __public__ = frozenset((
- 'method',
- ))
-
def method(self, n):
return n
class base1(plugable.Plugin):
- __public__ = frozenset((
- 'method',
- ))
-
def method(self, n):
return n + 1