summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-02-16 15:39:39 -0500
committerRob Crittenden <rcritten@redhat.com>2009-04-13 15:22:49 -0400
commite6171404bf0dce7cf08ef3044003190e18c851c9 (patch)
treea03e4a3524ce4c42a65a68cd4b92842c9e19c703
parent8821d8cac3140bcaa5193a470b5c0143454a96d4 (diff)
downloadfreeipa-e6171404bf0dce7cf08ef3044003190e18c851c9.tar.gz
freeipa-e6171404bf0dce7cf08ef3044003190e18c851c9.tar.xz
freeipa-e6171404bf0dce7cf08ef3044003190e18c851c9.zip
Make parentmap a autofill variable and add tests when parentmap is not passed
-rw-r--r--ipalib/plugins/automount.py1
-rw-r--r--tests/test_xmlrpc/test_automount_plugin.py58
2 files changed, 59 insertions, 0 deletions
diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index b25f512a5..b4b696d10 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -608,6 +608,7 @@ class automount_addindirectmap(crud.Add):
Str('parentmap?',
cli_name='parentmap',
default=u'auto.master',
+ autofill=True,
doc='The parent map to connect this to.',
),
Str('automountkey',
diff --git a/tests/test_xmlrpc/test_automount_plugin.py b/tests/test_xmlrpc/test_automount_plugin.py
index 4f9b9fdca..e2a3bd6f6 100644
--- a/tests/test_xmlrpc/test_automount_plugin.py
+++ b/tests/test_xmlrpc/test_automount_plugin.py
@@ -235,3 +235,61 @@ class test_Indirect(XMLRPC_test):
pass
else:
assert False
+
+class test_IndirectNoParent(XMLRPC_test):
+ """
+ Test the `automount` plugin Indirect map function.
+ """
+ mapname=u'auto.home'
+ keyname=u'/home'
+ parentmap=u'auto.master'
+ description=u'Home directories'
+ map_kw={'automountkey': keyname, 'description': description}
+
+ def test_add_indirect(self):
+ """
+ Test adding an indirect map with default parent.
+ """
+ res = api.Command['automount_addindirectmap'](self.mapname, **self.map_kw)
+ assert res
+ assert res.get('automountinformation','') == self.mapname
+
+ def test_doshowkey(self):
+ """
+ Test the `xmlrpc.automount_showkey` method with default parent.
+ """
+ showkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
+ res = api.Command['automount_showkey'](**showkey_kw)
+ assert res
+ assert res.get('automountkey','') == self.keyname
+
+ def test_remove_key(self):
+ """
+ Remove the indirect key /home
+ """
+ delkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
+ res = api.Command['automount_delkey'](**delkey_kw)
+ assert res == True
+
+ # Verify that it is gone
+ try:
+ res = api.Command['automount_showkey'](**delkey_kw)
+ except errors2.NotFound:
+ pass
+ else:
+ assert False
+
+ def test_remove_map(self):
+ """
+ Remove the indirect map for auto.home
+ """
+ res = api.Command['automount_delmap'](self.mapname)
+ assert res == True
+
+ # Verify that it is gone
+ try:
+ res = api.Command['automount_showmap'](self.mapname)
+ except errors2.NotFound:
+ pass
+ else:
+ assert False