diff MoinMoin/groups/backends/_tests/__init__.py @ 4803:167db6117bb4

Groups2009: pep8 fixes and typo elimination. BaseGroup._iter optimization. Test of group names mapping was removed.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Thu, 11 Jun 2009 13:48:54 +0200
parents 3b05bf18c0d1
children ca8fcf330aa8
line wrap: on
line diff
--- a/MoinMoin/groups/backends/_tests/__init__.py	Wed Jun 10 20:32:42 2009 +0200
+++ b/MoinMoin/groups/backends/_tests/__init__.py	Thu Jun 11 13:48:54 2009 +0200
@@ -13,19 +13,11 @@
 from py.test import raises
 
 from MoinMoin import security
-from MoinMoin._tests import wikiconfig
 
-class Config(wikiconfig.Config):
-    # Simply drop the "Group" postfix for group names given to a backend.
-    # Note: in the real world, this would not work good enough:
-    to_backend_name = lambda self, group_name:  group_name[:-5]
-    # Add "Group" postfix for group names received from a backend.
-    # Note: in the real world, this would not work good enough:
-    to_group_name = lambda self, backend_name:'%sGroup' % backend_name
 
 class BackendTest(object):
 
-    test_groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1'],
+    test_groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1', u'John'],
                    u'AdminGroup': [u'Admin1', u'Admin2', u'John'],
                    u'OtherGroup': [u'SomethingOther'],
                    u'RecursiveGroup': [u'Something', u'OtherRecursiveGroup'],
@@ -40,21 +32,13 @@
                        u'OtherRecursiveGroup': [u'Anything', u'Something'],
                        u'ThirdRecursiveGroup': [u'Banana']}
 
-    # These backend group names do not follow moin convention:
-    mapped_groups = {u'Editor': [u'Admin', u'John', u'JoeDoe', u'Editor1'],
-                     u'Admin': [u'Admin1', u'Admin2', u'John'],
-                     u'Other': [u'SomethingOther'],
-                     u'Recursive': [u'Something', u'OtherRecursive'],
-                     u'OtherRecursive': [u'Recursive', u'Anything'],
-                     u'ThirdRecursive': [u'ThirdRecursive', u'Banana']}
-
     def test_contains(self):
         """
         Test group_wiki Backend and Group containment methods.
         """
         groups = self.request.groups
 
-        for (group, members) in self.expanded_groups.iteritems():
+        for group, members in self.expanded_groups.iteritems():
             print group
             assert group in groups
             for member in members:
@@ -65,7 +49,7 @@
     def test_iter(self):
         groups = self.request.groups
 
-        for (group, members) in self.expanded_groups.iteritems():
+        for group, members in self.expanded_groups.iteritems():
             returned_members = [x for x in groups[group]]
             assert len(returned_members) == len(members)
             for member in members:
@@ -128,23 +112,6 @@
         assert not acl.may(request, u"Someone", "delete")
         assert not acl.may(request, u"Someone", "admin")
 
-class BackendTestMapping(BackendTest):
-    """
-    Test group name mapping:
-        moin -> backend (e.g. "AdminGroup" -> "ImportantAdminGroup")
-        backend -> moin (e.g. "ImportantAdminGroup" -> "AdminGroup")
-
-    Moin expects group names to match the page_group_regex (e.g. "AdminGroup"),
-    but a backend might want to use different group names (e.g. just "ImportantAdminGroup").
-    """
-    test_groups = {u'ImportantEditorGroup': [u'ImportantAdminGroup', u'John',
-                                             u'JoeDoe', u'Editor'],
-                   u'ImportantAdminGroup': [u'Admin', u'Admin2', u'John'],
-                   u'ImportantOtherGroup': [u'SomethingOther'],
-                   u'ImportantRecursiveGroup': [u'Something', u'ImportantOtherRecursiveGroup'],
-                   u'ImportantOtherRecursiveGroup': [u'ImportantRecursiveGroup', u'Anything'],
-                   u'ImportantThirdRecursiveGroup': [u'ImportantThirdRecursiveGroup', u'Banana']}
-
 
 coverage_modules = ['MoinMoin.groups.backends.config_group']