This has been wrong for some time, now I got around to fixing it properly.
It should go to all branches (4.0, 4.1, master).


--
PetrĀ³
From e069d262fd7021a3a6841065654de4f32eae4c71 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Fri, 19 Sep 2014 12:34:14 +0200
Subject: [PATCH] test_permission_plugin: Check legacy permissions

Currently a number of v2 permissions are in $SUFFIX, which the original
test did not anticipate.

Properly check that legacy permissions are found.
---
 ipatests/test_xmlrpc/test_permission_plugin.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_permission_plugin.py b/ipatests/test_xmlrpc/test_permission_plugin.py
index bb772050bd7ad7157b6a16b6320c39ec67091aaf..f58fa88ca731596a0e60e416d38eacefc273e03a 100644
--- a/ipatests/test_xmlrpc/test_permission_plugin.py
+++ b/ipatests/test_xmlrpc/test_permission_plugin.py
@@ -2842,19 +2842,27 @@ class test_permission_flags(Declarative):
             'Permission with unknown flag ?? may not be modified or removed'))
 
 
+def check_legacy_results(results):
+    """Check that the expected number of legacy permissions are in $SUFFIX"""
+    legacy_permissions = [p for p in results
+                          if not p.get('ipapermissiontype')]
+    print legacy_permissions
+    assert len(legacy_permissions) == 8, len(legacy_permissions)
+    return True
+
 class test_permission_legacy(Declarative):
     """Tests for non-upgraded permissions"""
 
     tests = [
         dict(
-            desc='Search for all permissions in $SUFFIX',
+            desc='Check that some legacy permission is found in $SUFFIX',
             command=('permission_find', [],
                      {'ipapermlocation': api.env.basedn}),
             expected=dict(
-                count=16,
+                count=lambda count: count,
                 truncated=False,
-                summary=u'16 permissions matched',
-                result=lambda s: True,
+                summary=lambda s: True,
+                result=check_legacy_results,
             ),
         ),
     ]
-- 
1.9.3

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

Reply via email to