stlaz's pull request #84: "Removed update_from_dict function from ldapupdate" 
was synchronize

See the full pull-request at https://github.com/freeipa/freeipa/pull/84
... or pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/84/head:pr84
git checkout pr84
From 404ecb27908da636e49a18602fbf05e843f31270 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Thu, 15 Sep 2016 13:52:35 +0200
Subject: [PATCH] Fix to testing of update_from_dict()

The tests did not respect the expected format to be passed to
update_from_dict() function. Also, removal of leaf entry
with its container was swapped so the tests may have never
worked.

https://fedorahosted.org/freeipa/ticket/6311
---
 ipatests/test_install/test_updates.py | 71 ++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/ipatests/test_install/test_updates.py b/ipatests/test_install/test_updates.py
index 3fa2cd7..c004667 100644
--- a/ipatests/test_install/test_updates.py
+++ b/ipatests/test_install/test_updates.py
@@ -270,32 +270,37 @@ def test_from_dict(self):
             entries = self.ld.get_entries(
                 self.user_dn, self.ld.SCOPE_BASE, 'objectclass=*', ['*'])
 
-
-        update = {
-            self.container_dn:
-                {'dn': self.container_dn,
-                 'updates': ['add:objectClass: top',
-                             'add:objectClass: nsContainer',
-                             'add:cn: test'
-                            ],
-                },
-            self.user_dn:
-                {'dn': self.user_dn,
-                 'updates': ['add:objectclass: top',
-                             'add:objectclass: person',
-                             'add:objectclass: posixaccount',
-                             'add:objectclass: krbprincipalaux',
-                             'add:objectclass: inetuser',
-                             'add:homedirectory: /home/tuser',
-                             'add:loginshell: /bin/bash',
-                             'add:sn: User',
-                             'add:uid: tuser',
-                             'add:uidnumber: 999',
-                             'add:gidnumber: 999',
-                             'add:cn: Test User',
-                            ],
-                },
-        }
+        update = [
+            {'dn': self.container_dn,
+             'updates':
+             [
+                {'action': 'add', 'attr': 'objectClass', 'value': 'top'},
+                {'action': 'add', 'attr': 'objectClass',
+                 'value': 'nsContainer'},
+                {'action': 'add', 'attr': 'cn', 'value': 'test'},
+             ],
+             },
+            {'dn': self.user_dn,
+             'updates':
+             [
+                {'action': 'add', 'attr': 'objectclass', 'value': 'top'},
+                {'action': 'add', 'attr': 'objectclass', 'value': 'person'},
+                {'action': 'add', 'attr': 'objectclass',
+                 'value': 'posixaccount'},
+                {'action': 'add', 'attr': 'objectclass',
+                 'value': 'krbprincipalaux'},
+                {'action': 'add', 'attr': 'objectclass', 'value': 'inetuser'},
+                {'action': 'add', 'attr': 'homedirectory',
+                 'value': '/home/tuser'},
+                {'action': 'add', 'attr': 'loginshell', 'value': '/bin/bash'},
+                {'action': 'add', 'attr': 'sn', 'value': 'User'},
+                {'action': 'add', 'attr': 'uid', 'value': 'tuser'},
+                {'action': 'add', 'attr': 'uidnumber', 'value': '999'},
+                {'action': 'add', 'attr': 'gidnumber', 'value': '999'},
+                {'action': 'add', 'attr': 'cn', 'value': 'Test User'},
+              ],
+             },
+        ]
 
         modified = self.updater.update_from_dict(update)
         self.assertTrue(modified)
@@ -327,16 +332,14 @@ def test_from_dict(self):
 
         # Now delete
 
-        update = {
-            self.container_dn:
-                {'dn': self.container_dn,
-                 'deleteentry': None,
-                },
-            self.user_dn:
+        update = [
                 {'dn': self.user_dn,
                  'deleteentry': 'deleteentry: reset: nada',
-                },
-        }
+                 },
+                {'dn': self.container_dn,
+                 'deleteentry': None,
+                 },
+        ]
 
         modified = self.updater.update_from_dict(update)
         self.assertTrue(modified)
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to