summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-12-14 11:06:26 +0100
committerRob Crittenden <rcritten@redhat.com>2010-12-20 11:27:46 -0500
commitffc6031ad76c2b28807e45a90b2906bf2e94b914 (patch)
treee5044bc605844b52ba5fdde6ec5ebf74b570f062 /tests/test_ipalib
parentbf778a74a3f750af5a0ebc7f72a0db655d25ef66 (diff)
downloadfreeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.tar.gz
freeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.tar.xz
freeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.zip
Allow RDN changes from CLI
https://fedorahosted.org/freeipa/ticket/397
Diffstat (limited to 'tests/test_ipalib')
-rw-r--r--tests/test_ipalib/test_parameters.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_parameters.py b/tests/test_ipalib/test_parameters.py
index 996d9af29..7f44f47fe 100644
--- a/tests/test_ipalib/test_parameters.py
+++ b/tests/test_ipalib/test_parameters.py
@@ -359,6 +359,34 @@ class test_Param(ClassChecker):
assert clone.param_spec == 'my_param'
assert clone.name == 'my_param'
+ def test_clone_rename(self):
+ """
+ Test the `ipalib.parameters.Param.clone` method.
+ """
+ new_name = 'my_new_param'
+
+ # Test with the defaults
+ orig = self.cls('my_param')
+ clone = orig.clone_rename(new_name)
+ assert clone is not orig
+ assert type(clone) is self.cls
+ assert clone.name == new_name
+ for (key, kind, default) in self.cls.kwargs:
+ assert getattr(clone, key) is getattr(orig, key)
+
+ # Test with overrides:
+ orig = self.cls('my_param*')
+ assert orig.required is False
+ assert orig.multivalue is True
+ clone = orig.clone_rename(new_name, required=True)
+ assert clone is not orig
+ assert type(clone) is self.cls
+ assert clone.required is True
+ assert clone.multivalue is True
+ assert clone.param_spec == new_name
+ assert clone.name == new_name
+
+
def test_convert(self):
"""
Test the `ipalib.parameters.Param.convert` method.