summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib
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
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')
-rw-r--r--tests/test_ipalib/test_backend.py1
-rw-r--r--tests/test_ipalib/test_frontend.py16
-rw-r--r--tests/test_ipalib/test_plugable.py101
3 files changed, 0 insertions, 118 deletions
diff --git a/tests/test_ipalib/test_backend.py b/tests/test_ipalib/test_backend.py
index 82cf17aac..6517bec9e 100644
--- a/tests/test_ipalib/test_backend.py
+++ b/tests/test_ipalib/test_backend.py
@@ -39,7 +39,6 @@ class test_Backend(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (plugable.Plugin,)
- assert self.cls.__proxy__ is False
class Disconnect(object):
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index 4cdb8774e..b5ecd053a 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -250,7 +250,6 @@ class test_Command(ClassChecker):
"""
Test the ``ipalib.frontend.Command.args`` instance attribute.
"""
- assert 'args' in self.cls.__public__ # Public
assert self.cls().args is None
o = self.cls()
o.finalize()
@@ -300,7 +299,6 @@ class test_Command(ClassChecker):
"""
Test the ``ipalib.frontend.Command.options`` instance attribute.
"""
- assert 'options' in self.cls.__public__ # Public
assert self.cls().options is None
o = self.cls()
o.finalize()
@@ -389,7 +387,6 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.convert` method.
"""
- assert 'convert' in self.cls.__public__ # Public
kw = dict(
option0=u'1.5',
option1=u'7',
@@ -403,7 +400,6 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.normalize` method.
"""
- assert 'normalize' in self.cls.__public__ # Public
kw = dict(
option0=u'OPTION0',
option1=u'OPTION1',
@@ -417,14 +413,12 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.get_default` method.
"""
- assert 'get_default' in self.cls.__public__ # Public
# FIXME: Add an updated unit tests for get_default()
def test_validate(self):
"""
Test the `ipalib.frontend.Command.validate` method.
"""
- assert 'validate' in self.cls.__public__ # Public
sub = self.subcls()
sub.finalize()
@@ -457,7 +451,6 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.execute` method.
"""
- assert 'execute' in self.cls.__public__ # Public
o = self.cls()
e = raises(NotImplementedError, o.execute)
assert str(e) == 'Command.execute()'
@@ -466,7 +459,6 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.args_options_2_params` method.
"""
- assert 'args_options_2_params' in self.cls.__public__ # Public
# Test that ZeroArgumentError is raised:
o = self.get_instance()
@@ -548,7 +540,6 @@ class test_Command(ClassChecker):
"""
Test the `ipalib.frontend.Command.params_2_args_options` method.
"""
- assert 'params_2_args_options' in self.cls.__public__ # Public
o = self.get_instance(args='one', options='two')
assert o.params_2_args_options() == ((None,), {})
assert o.params_2_args_options(one=1) == ((1,), {})
@@ -915,7 +906,6 @@ class test_Object(ClassChecker):
"""
Test the `ipalib.frontend.Object.get_dn` method.
"""
- assert 'get_dn' in self.cls.__public__ # Public
o = self.cls()
e = raises(NotImplementedError, o.get_dn, 'primary key')
assert str(e) == 'Object.get_dn()'
@@ -1019,8 +1009,6 @@ class test_Method(ClassChecker):
Test the `ipalib.frontend.Method` class.
"""
assert self.cls.__bases__ == (frontend.Attribute, frontend.Command)
- assert self.cls.implements(frontend.Command)
- assert self.cls.implements(frontend.Attribute)
def test_init(self):
"""
@@ -1032,10 +1020,6 @@ class test_Method(ClassChecker):
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):
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