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:13 UTC
[16/17] allura git commit: [#7852] Added tests to confirm 'mod_time'
field does not get updated on page view.
[#7852] Added tests to confirm 'mod_time' field does not get updated on page view.
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fc066e31
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fc066e31
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fc066e31
Branch: refs/heads/hs/7852
Commit: fc066e31bb244c1445b19def36a2d70fa0fdd1c3
Parents: b5b01d0
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue Apr 14 13:31:12 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Apr 16 13:04:18 2015 -0400
----------------------------------------------------------------------
.../forgetracker/templates/tracker/ticket.html | 2 +-
.../forgetracker/tests/functional/test_root.py | 21 ++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/fc066e31/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 27331c8..5f9f534 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -123,7 +123,7 @@
<div style="clear:both"></div>
<div class="grid-4">
<label class="simple">Updated:</label>
- {{abbr_date(ticket.mod_date)}}
+ <span id="updated_id">{{abbr_date(ticket.mod_date)}}</span>
</div>
<div class="grid-4">
<label class="simple">Created:</label>
http://git-wip-us.apache.org/repos/asf/allura/blob/fc066e31/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 21a3564..d096010 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -16,6 +16,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+from datetime import datetime
import urllib
import os
@@ -720,6 +721,26 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get('/bugs/markdown_syntax')
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):
+ 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',
+ mod_date=datetime(2010, 1, 1, 1, 1, 1))
+ ticket = tm.Ticket(**params)
+ session = artifact_orm_session._get()
+ setattr(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)
+
def test_ticket_diffs(self):
self.new_ticket(summary='difftest', description='1\n2\n3\n')
self.app.post('/bugs/1/update_ticket', {