You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/04/16 19:43:23 UTC
[3/3] 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/3d7b62b2
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3d7b62b2
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3d7b62b2
Branch: refs/heads/master
Commit: 3d7b62b2e3f510ee1e935817251a78c71aecfc86
Parents: fc066e3
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Apr 16 13:03:47 2015 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Apr 16 17:30:12 2015 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 2 +-
.../forgetracker/tests/functional/test_root.py | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/3d7b62b2/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 31f3c79..e9879de 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -133,7 +133,7 @@ class ForgeMarkdown(markdown.Markdown):
# Prevent cache creation from updating the mod_date timestamp.
_session = artifact_orm_session._get()
- setattr(_session, 'skip_mod_date', True)
+ _session.skip_mod_date = True
return html
http://git-wip-us.apache.org/repos/asf/allura/blob/3d7b62b2/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')