You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/16 19:05:14 UTC

[17/17] allura git commit: [#7852] Removed cached_convert mock from test_cached_convert.

[#7852] Removed cached_convert mock from test_cached_convert.


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/7f4d9197
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/7f4d9197
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/7f4d9197

Branch: refs/heads/hs/7852
Commit: 7f4d919710c1cbe66974f4e3186dff6af57884ca
Parents: fc066e3
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Apr 16 13:03:47 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Apr 16 13:04:18 2015 -0400

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py         | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/7f4d9197/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index d096010..e8195d5 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -722,24 +722,29 @@ class TestFunctionalController(TrackerTestController):
         assert_true('Markdown Syntax' in r)
 
     @patch.dict('allura.lib.app_globals.config', markdown_cache_threshold='0')
-    @patch('allura.lib.app_globals.ForgeMarkdown.cached_convert')
-    def test_cached_convert(self, mock_cached_convert):
+    def test_cached_convert(self):
         from allura.model.session import artifact_orm_session
         # Create ticket
         params = dict(ticket_num=1,
                       app_config_id=c.app.config._id,
                       summary=u'test md cache',
+                      description=u'# Test markdown cached_convert',
                       mod_date=datetime(2010, 1, 1, 1, 1, 1))
         ticket = tm.Ticket(**params)
+
+        # Enable skip_mod_date to prevent mod_date from being set automatically when the ticket is saved.
         session = artifact_orm_session._get()
-        setattr(session, 'skip_mod_date', True)
+        session.skip_mod_date = True
 
         # This visit will cause cache to be stored on the artifact.
         # We want to make sure the 'last_updated' field isn't updated by the cache creation
         r = self.app.get('/bugs/1').follow()
         last_updated = r.html.find("span", {"id": "updated_id"}).text
         assert_equal(last_updated, '2010-01-01')
-        assert_equal(mock_cached_convert.call_count, 1)
+
+        # Make sure the cache has been saved.
+        t = tm.Ticket.query.find({'_id': ticket._id}).first()
+        assert_in('<h1 id="test-markdown-cached_convert">Test markdown cached_convert</h1>', t.description_cache.html)
 
     def test_ticket_diffs(self):
         self.new_ticket(summary='difftest', description='1\n2\n3\n')