Fix automountkey-mod so that automountkey attribute is correctly
updated. Add this test case to the unit tests.

https://fedorahosted.org/freeipa/ticket/1528

>From d1ba81e623f369777b297f8948dda30a24c63e63 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Wed, 27 Jul 2011 15:26:57 +0200
Subject: [PATCH] Fix automountkey-mod

Fix automountkey-mod so that automountkey attribute is correctly
updated. Add this test case to the unit tests.

https://fedorahosted.org/freeipa/ticket/1528
---
 ipalib/plugins/automount.py                |    2 ++
 tests/test_xmlrpc/test_automount_plugin.py |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index d692b2c866f787f46623abb01dad87e560a9c797..9577d66fb37583bba3a75e4fdbf359a88d4c98ed 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -856,6 +856,8 @@ class automountkey_mod(LDAPUpdate):
         entry_attrs['description'] = self.obj.get_pk(
                                             options['automountkey'],
                                             options['newautomountinformation'])
+        if 'rename' in options:
+            entry_attrs['automountkey'] = options['rename']
         return dn
 
     def execute(self, *keys, **options):
diff --git a/tests/test_xmlrpc/test_automount_plugin.py b/tests/test_xmlrpc/test_automount_plugin.py
index c5dd619e254e45739f1abad4f78e7337dc46b096..9866c78f4631afac31a45d45daecd058dc24dc18 100644
--- a/tests/test_xmlrpc/test_automount_plugin.py
+++ b/tests/test_xmlrpc/test_automount_plugin.py
@@ -34,6 +34,7 @@ class test_automount(XMLRPC_test):
     locname = u'testlocation'
     mapname = u'testmap'
     keyname = u'testkey'
+    keyname_rename = u'testkey_rename'
     keyname2 = u'testkey2'
     description = u'description of map'
     info = u'ro'
@@ -127,9 +128,11 @@ class test_automount(XMLRPC_test):
         Test the `xmlrpc.automountkey_mod` method.
         """
         self.key_kw['newautomountinformation'] = self.newinfo
+        self.key_kw['rename'] = self.keyname_rename
         res = api.Command['automountkey_mod'](self.locname, self.mapname, **self.key_kw)['result']
         assert res
-        assert_attr_equal(res, 'automountinformation', 'rw')
+        assert_attr_equal(res, 'automountinformation', self.newinfo)
+        assert_attr_equal(res, 'automountkey', self.keyname_rename)
 
     def test_a_automountmap_mod(self):
         """
@@ -144,7 +147,7 @@ class test_automount(XMLRPC_test):
         """
         Test the `xmlrpc.automountkey_del` method.
         """
-        delkey_kw={'automountkey': self.keyname, 'automountinformation' : self.newinfo, 'raw': True}
+        delkey_kw={'automountkey': self.keyname_rename, 'automountinformation' : self.newinfo, 'raw': True}
         res = api.Command['automountkey_del'](self.locname, self.mapname, **delkey_kw)['result']
         assert res
         assert_attr_equal(res, 'failed', '')
-- 
1.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to