summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 3ef7ad08..f05a9c31 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -93,32 +93,9 @@ class test_option():
#assert issubclass(cls, plugable.ReadOnly)
assert type(cls.rules) is property
- def test_rules(self):
- """
- Test the rules property.
- """
- o = self.sub()()
- assert len(o.rules) == 3
- def get_rule(i):
- return getattr(o, 'rule_%d' % i)
- rules = tuple(get_rule(i) for i in xrange(3))
- assert o.rules == rules
-
- def test_validation(self):
- """
- Test the validation method.
- """
- o = self.sub()()
- o.validate(9)
- for i in xrange(3):
- e = raises(errors.RuleError, o.validate, i)
- assert e.error == 'cannot be %d' % i
-
def test_normalize(self):
sub = self.sub()
-
i = sub()
-
# Test with values that can't be converted:
nope = (
'7.0'
@@ -145,6 +122,30 @@ class test_option():
for val in okay:
assert i.normalize(val) == 7
+ def test_rules(self):
+ """
+ Test the rules property.
+ """
+ o = self.sub()()
+ assert len(o.rules) == 3
+ def get_rule(i):
+ return getattr(o, 'rule_%d' % i)
+ rules = tuple(get_rule(i) for i in xrange(3))
+ assert o.rules == rules
+
+ def test_validation(self):
+ """
+ Test the validation method.
+ """
+ o = self.sub()()
+ o.validate(9)
+ for i in xrange(3):
+ e = raises(errors.RuleError, o.validate, i)
+ assert e.error == 'cannot be %d' % i
+ assert e.value == i
+
+
+
def test_cmd():
cls = public.cmd
assert issubclass(cls, plugable.Plugin)