diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-09 01:46:12 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-09 01:46:12 +0000 |
commit | 3495c67d57868a02bafe6f1935d4846cd5615bf5 (patch) | |
tree | 389815c4ddaec1777ddb789751e1b83a595b1324 /ipalib/tests/test_plugable.py | |
parent | cc5b0174949a4769876a892b210a9faa9683d81e (diff) | |
download | freeipa.git-3495c67d57868a02bafe6f1935d4846cd5615bf5.tar.gz freeipa.git-3495c67d57868a02bafe6f1935d4846cd5615bf5.tar.xz freeipa.git-3495c67d57868a02bafe6f1935d4846cd5615bf5.zip |
94: Renamed Proxy._clone() method to Proxy.__clone__(); updated unit tests
Diffstat (limited to 'ipalib/tests/test_plugable.py')
-rw-r--r-- | ipalib/tests/test_plugable.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index faf2fd92..605debe5 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -174,12 +174,12 @@ class test_ProxyTarget(ClassChecker): class test_Proxy(ClassChecker): """ - Test the `Proxy` class. + Tests the `Proxy` class. """ _cls = plugable.Proxy def test_class(self): - assert self.cls.__bases__ == (plugable.ReadOnly,) + assert self.cls.__bases__ == (plugable.ReadOnly,) def test_proxy(self): # Setup: @@ -242,19 +242,9 @@ class test_Proxy(ClassChecker): p = self.cls(base, i, 'attr_name') assert read_only(p, 'name') == 'add' - # Test _clone(): - i = plugin() - p = self.cls(base, i) - assert read_only(p, 'name') == 'user_add' - c = p._clone('attr_name') - assert isinstance(c, self.cls) - assert read_only(c, 'name') == 'add' - assert c is not p - assert c('whoever') == p('whoever') - def test_implements(self): """ - Test the `implements` method. + Tests the `implements` method. """ class base(object): __public__ = frozenset() @@ -276,6 +266,23 @@ class test_Proxy(ClassChecker): p = self.cls(base, o) assert p.implements(3) == 10 + def test_clone(self): + """ + Tests the `__clone__` method. + """ + class base(object): + __public__ = frozenset() + class sub(base): + name = 'some_name' + label = 'another_name' + + p = self.cls(base, sub()) + assert read_only(p, 'name') == 'some_name' + c = p.__clone__('label') + assert isinstance(c, self.cls) + assert c is not p + assert read_only(c, 'name') == 'another_name' + def test_Plugin(): cls = plugable.Plugin |