changeset 2878:455c3f051a2d

test_wikidicts: rename Group page test added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 26 Sep 2007 17:47:42 +0200
parents 384135a7bb0a
children 07cd2b5f0fb9
files MoinMoin/_tests/test_wikidicts.py
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikidicts.py	Wed Sep 26 17:45:30 2007 +0200
+++ b/MoinMoin/_tests/test_wikidicts.py	Wed Sep 26 17:47:42 2007 +0200
@@ -12,6 +12,8 @@
 
 from MoinMoin import wikidicts
 from MoinMoin import Page
+from MoinMoin.PageEditor import PageEditor
+from MoinMoin._tests.common import gain_superuser_rights
 
 class TestGroupPage:
 
@@ -114,5 +116,31 @@
         assert 'RecentChanges' in members
         assert 'HelpContents' in members
 
+    def testRenameGroupPage(self):
+        """
+         tests if the dict cache for groups is refreshed after renaming a Group page
+        """
+        gain_superuser_rights(self.request)
+        pagename = u'SomeGroup'
+        page = PageEditor(self.request, pagename, do_editor_backup=False)
+        body = " * ExampleUser"
+        page.saveText(body, 0)
+
+        page.renamePage('AnotherGroup')
+
+        group = wikidicts.Group(self.request, '')
+        isgroup = self.request.cfg.cache.page_group_regex.search
+        grouppages = self.request.rootpage.getPageList(user='', filter=isgroup)
+
+        members, groups = self.request.dicts.expand_group(u'AnotherGroup')
+        page = PageEditor(self.request, u'AnotherGroup', do_editor_backup=0)
+
+        # real delete AnotherGroup page from filesystem
+        import shutil
+        fpath = page.getPagePath(check_create=0)
+        shutil.rmtree(fpath, True)
+
+        assert u'ExampleUser' in members
+
 coverage_modules = ['MoinMoin.wikidicts']