summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-07 05:02:56 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-07 05:02:56 +0000
commit2cc88a7a3233d6bd70ec174ba976d093dc7f0d98 (patch)
tree01bce05442cfc7b4759758a36c369e11b529c989 /ipalib/tests/test_public.py
parent8a6041b7978d370418e99df8b9fc06b2055a39e6 (diff)
downloadfreeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.tar.gz
freeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.tar.xz
freeipa.git-2cc88a7a3233d6bd70ec174ba976d093dc7f0d98.zip
74: Finished opt.__rules_iter(); is_rule(obj) now returns False if obj is not callable; updated unit tests
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 122f489d..ef2ded17 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -47,27 +47,20 @@ def test_is_rule():
is_rule = public.is_rule
flag = public.RULE_FLAG
- class example(object):
+ class no_call(object):
def __init__(self, value):
if value is not None:
assert value in (True, False)
setattr(self, flag, value)
- obj = example(True)
- assert getattr(obj, flag) is True
- assert is_rule(obj)
-
- obj = example(False)
- assert getattr(obj, flag) is False
- assert not is_rule(obj)
-
- obj = example(None)
- assert not hasattr(obj, flag)
- assert not is_rule(obj)
-
-
-
+ class call(no_call):
+ def __call__(self):
+ pass
+ assert is_rule(call(True))
+ assert not is_rule(no_call(True))
+ assert not is_rule(call(False))
+ assert not is_rule(call(None))
class test_opt():