From b3fc5f9a41685f40da0702f860e6182182783150 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 8 Aug 2008 06:18:12 +0000 Subject: 79: More work on option and cmd --- ipalib/tests/test_public.py | 47 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'ipalib/tests/test_public.py') 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) -- cgit