summaryrefslogtreecommitdiffstats
path: root/ipalib/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-21 18:50:00 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-21 18:50:00 +0000
commit4a96ec2dc7975e5c6f76e87be0c62a51d262de32 (patch)
tree9bda9c6a1002cd4f37790ef9a909f93705a0c2c5 /ipalib/tests
parentf8953720c4438c34f5e42ca3949e8078ca777fe4 (diff)
downloadfreeipa-4a96ec2dc7975e5c6f76e87be0c62a51d262de32.tar.gz
freeipa-4a96ec2dc7975e5c6f76e87be0c62a51d262de32.tar.xz
freeipa-4a96ec2dc7975e5c6f76e87be0c62a51d262de32.zip
304: args, options, & params namespaces are now created in Command.finalize() instead of Command.__init__(); updated corresponding unit tests
Diffstat (limited to 'ipalib/tests')
-rw-r--r--ipalib/tests/test_public.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index f45d1abea..865a18fd3 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -378,7 +378,9 @@ class test_Command(ClassChecker):
class example(self.cls):
takes_args = args
takes_options = options
- return example()
+ o = example()
+ o.finalize(object)
+ return o
def test_class(self):
assert self.cls.__bases__ == (plugable.Plugin,)
@@ -408,9 +410,11 @@ class test_Command(ClassChecker):
Tests the ``Command.args`` instance attribute.
"""
assert 'args' in self.cls.__public__ # Public
- ns = self.cls().args
- assert type(ns) is plugable.NameSpace
- assert len(ns) == 0
+ assert self.cls().args is None
+ o = self.cls()
+ o.finalize(object)
+ assert type(o.args) is plugable.NameSpace
+ assert len(o.args) == 0
args = ('destination', 'source?')
ns = self.get_instance(args=args).args
assert type(ns) is plugable.NameSpace
@@ -456,9 +460,11 @@ class test_Command(ClassChecker):
Tests the ``Command.options`` instance attribute.
"""
assert 'options' in self.cls.__public__ # Public
- ns = self.cls().options
- assert type(ns) is plugable.NameSpace
- assert len(ns) == 0
+ assert self.cls().options is None
+ o = self.cls()
+ o.finalize(object)
+ assert type(o.options) is plugable.NameSpace
+ assert len(o.options) == 0
options = ('target', 'files*')
ns = self.get_instance(options=options).options
assert type(ns) is plugable.NameSpace
@@ -485,6 +491,7 @@ class test_Command(ClassChecker):
expected = dict(kw)
expected.update(dict(option0=u'option0', option1=u'option1'))
o = self.subcls()
+ o.finalize(object)
for (key, value) in o.convert(**kw).iteritems():
v = expected[key]
assert value == v
@@ -502,6 +509,7 @@ class test_Command(ClassChecker):
)
norm = dict((k, v.lower()) for (k, v) in kw.items())
sub = self.subcls()
+ sub.finalize(object)
assert sub.normalize(**kw) == norm
def test_get_default(self):
@@ -522,6 +530,7 @@ class test_Command(ClassChecker):
option1='the default',
)
sub = self.subcls()
+ sub.finalize(object)
assert sub.get_default(**no_fill) == {}
assert sub.get_default(**fill) == default
@@ -532,6 +541,7 @@ class test_Command(ClassChecker):
assert 'validate' in self.cls.__public__ # Public
sub = self.subcls()
+ sub.finalize(object)
# Check with valid args
okay = dict(