incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [50/50] git commit: [#6007] fix more test failures
Date Fri, 03 May 2013 21:58:20 GMT
[#6007] fix more test failures


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

Branch: refs/heads/db/6007
Commit: b6914fbb6a8b13f01dc3446d9c2df39fe16cb72d
Parents: 8d01a3b
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri May 3 17:57:09 2013 -0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri May 3 17:57:09 2013 -0400

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py               |    3 +-
 Allura/allura/lib/app_globals.py                   |    5 +++-
 .../forgediscussion/tests/functional/test_forum.py |   20 +++++++-------
 3 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b6914fbb/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 96f8979..44262f9 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -300,7 +300,8 @@ class PostController(BaseController):
                     thread=self.post.thread,
                     reply_subject=self.post.reply_subject,
                     attachments=self.post.attachments,
-                    related_artifacts=self.post.related_artifacts
+                    related_artifacts=self.post.related_artifacts,
+                    parent_security_context=lambda: None,
                     )
             else:
                 post=self.post

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b6914fbb/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index c6004d3..daac282 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -327,7 +327,10 @@ class Globals(object):
                 c.user.set_pref('results_per_page', int(limit))
         else:
             if c.user in (None, M.User.anonymous()):
-                limit = 'results_per_page' in session and session['results_per_page'] or
default
+                try:
+                    limit = session['results_per_page']
+                except (KeyError, TypeError):  # TypeError if no session registered for thread
+                    limit = default
             else:
                 limit = c.user.get_pref('results_per_page') or default
         return limit

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b6914fbb/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index 73b6682..1645dcf 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -139,7 +139,7 @@ class TestForumAsync(TestController):
         r = self.app.get('/admin/discussion/forums')
         assert 'Test Forum 1' in r
         h.set_context('test', 'discussion', neighborhood='Projects')
-        self.user_id = M.User.query.get(username='root')._id
+        self.user = M.User.query.get(username='root')
 
     def test_has_access(self):
         assert False == c.app.has_access(M.User.anonymous(), 'testforum')
@@ -248,15 +248,15 @@ class TestForumAsync(TestController):
 
     def _post(self, topic, subject, body, **kw):
         message_id = kw.pop('message_id', '%s@test.com' % random.random())
-        c.app.handle_message(
-            topic,
-            dict(kw,
-                 project_id=c.project._id,
-                 mount_point='discussion',
-                 headers=dict(Subject=subject),
-                 user_id=self.user_id,
-                 payload=body,
-                 message_id=message_id))
+        with h.push_config(c, user=self.user):
+            c.app.handle_message(
+                topic,
+                dict(kw,
+                     project_id=c.project._id,
+                     mount_point='discussion',
+                     headers=dict(Subject=subject),
+                     payload=body,
+                     message_id=message_id))
         M.artifact_orm_session.flush()
 
 class TestForum(TestController):


Mime
View raw message