changeset 2836:f5049c4cbf6e

wikidicts.dict: loads current dict. fixed and new tests
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 14 Sep 2007 12:53:23 +0200
parents 9c4c20145a1f
children 9fdc81419de7
files MoinMoin/_tests/test_PageEditor.py MoinMoin/macro/_tests/test_GetVal.py MoinMoin/wikidicts.py
diffstat 3 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_PageEditor.py	Fri Sep 14 00:43:22 2007 +0200
+++ b/MoinMoin/_tests/test_PageEditor.py	Fri Sep 14 12:53:23 2007 +0200
@@ -208,8 +208,6 @@
         """
         simple test if it is possible to delete a Dict page after creation
         """
-        py.test.skip('broken test for page ending with Dict - global state is changed somehow that test_GetVal looks broken')
-
         pagename = u'SomeDict'
         page = PageEditor(self.request, pagename, do_editor_backup=0)
         body = u"This is an example text"
--- a/MoinMoin/macro/_tests/test_GetVal.py	Fri Sep 14 00:43:22 2007 +0200
+++ b/MoinMoin/macro/_tests/test_GetVal.py	Fri Sep 14 12:53:23 2007 +0200
@@ -66,19 +66,7 @@
 
     def testGetValNoACLs(self):
         """ macro GetVal test: 'reads VAR' """
-        # py.test.skip("broken test")
-        # seems not to go well after test_PageEditor and test_events
-        # are both excluded it works e.g.
-        '''
-         py.test MoinMoin/_tests/test_Page.py MoinMoin/_tests/test_error.py
-         MoinMoin/_tests/test_packages.py MoinMoin/_tests/test_user.py
-         MoinMoin/_tests/test_wikidicts.py MoinMoin/_tests/test_wikisync.py
-         MoinMoin/_tests/test_wikiutil.py MoinMoin/action/_tests/test_attachfile.py
-         MoinMoin/config/_tests/test_multiconfig.py
-         MoinMoin/converter/_tests/test_text_html_text_moin_wiki.py
-         MoinMoin/filter/_tests/test_filter.py MoinMoin/macro/_tests/test_Action.py
-         MoinMoin/formatter/_tests/test_formatter.py MoinMoin/macro/_tests/test_GetVal.py
-        '''
+
         self.shouldDeleteTestPage = True
         self._createTestPage(u' VAR:: This is an example')
 
@@ -89,6 +77,25 @@
         expected = "This is an example"
         assert result == expected
 
+    def testGetValAfterADictPageIsDeleted(self):
+        """ macro GetVal test: 'reads Dict var after another Dict is removed' """
+
+        self.shouldDeleteTestPage = True
+
+        pagename = u'SomeDict'
+        page = PageEditor(self.request, pagename, do_editor_backup=0)
+        body = u" EXAMPLE:: This is an example text"
+        page.saveText(body, 0)
+        success_i, result = page.deletePage()
+
+        self._createTestPage(u' VAR:: This is a brand new example')
+        page = Page(self.request, self.pagename)
+        args = "%s,%s" % (self.pagename, u'VAR')
+        result = self._test_macro(u'GetVal', args)
+
+        expected = "This is a brand new example"
+        assert result == expected
+
     def testGetValACLs(self):
         """ macro GetVal test: 'cant read VAR on an ACL protected page' """
         py.test.skip("user has no rights to create acl pages")
--- a/MoinMoin/wikidicts.py	Fri Sep 14 00:43:22 2007 +0200
+++ b/MoinMoin/wikidicts.py	Fri Sep 14 12:53:23 2007 +0200
@@ -159,6 +159,7 @@
 
     def dict(self, dictname):
         """ get dict <dictname> """
+        self.load_dicts() # reload dicts (needs to be done to have current dicts)
         try:
             d = self.dictdict[dictname]
         except KeyError: