mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
104: public.option now subclasses from plugable.Plugin; cleaned up unit tests for option
This commit is contained in:
parent
d7958f3fde
commit
f6b69a5905
@ -38,7 +38,7 @@ def is_rule(obj):
|
||||
return callable(obj) and getattr(obj, RULE_FLAG, False) is True
|
||||
|
||||
|
||||
class option(object):
|
||||
class option(plugable.Plugin):
|
||||
"""
|
||||
The option class represents a kw argument from a command.
|
||||
"""
|
||||
|
@ -63,10 +63,10 @@ def test_is_rule():
|
||||
assert not is_rule(call(None))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class test_option(ClassChecker):
|
||||
"""
|
||||
Tests the option class.
|
||||
"""
|
||||
_cls = public.option
|
||||
|
||||
def get_subcls(self):
|
||||
@ -91,10 +91,13 @@ class test_option(ClassChecker):
|
||||
"""
|
||||
Perform some tests on the class (not an instance).
|
||||
"""
|
||||
#assert issubclass(cls, plugable.ReadOnly)
|
||||
assert self.cls.__bases__ == (plugable.Plugin,)
|
||||
assert type(self.cls.rules) is property
|
||||
|
||||
def test_normalize(self):
|
||||
"""
|
||||
Tests the `normalize` method.
|
||||
"""
|
||||
assert 'normalize' in self.cls.__public__
|
||||
o = self.subcls()
|
||||
# Test with values that can't be converted:
|
||||
@ -125,7 +128,7 @@ class test_option(ClassChecker):
|
||||
|
||||
def test_validate(self):
|
||||
"""
|
||||
Test the validate method.
|
||||
Tests the `validate` method.
|
||||
"""
|
||||
assert 'validate' in self.cls.__public__
|
||||
o = self.subcls()
|
||||
@ -137,7 +140,7 @@ class test_option(ClassChecker):
|
||||
|
||||
def test_rules(self):
|
||||
"""
|
||||
Test the rules property.
|
||||
Tests the `rules` property.
|
||||
"""
|
||||
o = self.subcls()
|
||||
assert len(o.rules) == 3
|
||||
@ -147,13 +150,13 @@ class test_option(ClassChecker):
|
||||
assert o.rules == rules
|
||||
|
||||
def test_default(self):
|
||||
"""
|
||||
Tests the `default` method.
|
||||
"""
|
||||
assert 'default' in self.cls.__public__
|
||||
assert self.cls().default() is None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def test_cmd():
|
||||
cls = public.cmd
|
||||
assert issubclass(cls, plugable.Plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user