incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [04/16] git commit: [#6007] fix more test failures
Date Tue, 04 Jun 2013 20:03:00 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/d07ea1e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d07ea1e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d07ea1e8

Branch: refs/heads/cj/6218
Commit: d07ea1e86fcc9dfffc6796d976393cb8d1d5f083
Parents: 2927da2
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri May 3 17:57:09 2013 -0400
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Tue Jun 4 14:40:52 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py               |    3 +-
 Allura/allura/lib/app_globals.py                   |    5 ++-
 .../forgediscussion/tests/functional/test_forum.py |   20 ++++++------
 .../forgegit/tests/functional/test_controllers.py  |    6 ++--
 ForgeGit/forgegit/tests/model/test_repository.py   |   11 +++----
 ForgeSVN/forgesvn/tests/model/test_repository.py   |    6 ++--
 ForgeUserStats/forgeuserstats/tests/test_stats.py  |   24 +++++++-------
 7 files changed, 39 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d07ea1e8/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 5f65515..fbfbaf0 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -299,7 +299,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/d07ea1e8/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index a94976b..26e0854 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -330,7 +330,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/d07ea1e8/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 4acf35c..c9f7196 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):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d07ea1e8/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index fd61b4a..204f729 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -238,7 +238,8 @@ class TestRootController(_TestCase):
 
     def test_refresh(self):
         notification = M.Notification.query.find(
-            dict(subject='[test:src-git] 5 new commits to test Git')).first()
+            dict(subject='[test:src-git] 5 new commits to Test Project Git')).first()
+        assert notification
         domain = '.'.join(reversed(c.app.url[1:-1].split('/'))).replace('_', '-')
         common_suffix = tg.config.get('forgemail.domain', '.sourceforge.net')
         email = 'noreply@%s%s' % (domain, common_suffix)
@@ -428,7 +429,7 @@ class TestFork(_TestCase):
     def test_fork_form(self):
         r = self.app.get('%sfork/' % c.app.repo.url())
         assert '<input type="text" name="mount_point" value="test"/>' in r
-        assert '<input type="text" name="mount_label" value="test - Git"/>' in r
+        assert '<input type="text" name="mount_label" value="Test Project - Git"/>'
in r, r
 
     def test_fork_listed_in_parent(self):
         assert 'Forks' in self._upstream_page()
@@ -510,4 +511,3 @@ class TestDiff(TestController):
         r = self.app.get('/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png?diff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
         assert 'alt="2ce83a2..."' in r
         assert 'alt="d961abb..."' in r
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d07ea1e8/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 316f202..46be17f 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -262,15 +262,14 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
     def test_notification_email(self):
         send_notifications(self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', ])
         ThreadLocalORMSession.flush_all()
-        notifications = M.Notification.query.find().sort('pubdate')
-        n = notifications.all()[2]
-        assert_equal(n.subject, '[test:src-git] [1e146e] - Rick Copeland: Change README')
+        n = M.Notification.query.find(
+            dict(subject='[test:src-git] [1e146e] - Rick Copeland: Change README')).first()
+        assert n
         assert 'master,zz: ' in n.text
         send_notifications(self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', 'df30427c488aeab84b2352bdf88a3b19223f9d7a'])
         ThreadLocalORMSession.flush_all()
-        notifications = M.Notification.query.find().sort('pubdate')
-        n = notifications.all()[3]
-        assert_equal(n.subject, '[test:src-git] 2 new commits to test Git')
+        assert M.Notification.query.find(
+            dict(subject='[test:src-git] 2 new commits to Test Project Git')).first()
 
     def test_tarball(self):
         tmpdir = tg.config['scm.repos.tarball.root']

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d07ea1e8/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 01ca3df..0bc2f86 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -536,9 +536,9 @@ class TestSVNRev(unittest.TestCase):
         commits = self.repo.commits()
         send_notifications(self.repo, [commits[4], ])
         ThreadLocalORMSession.flush_all()
-        notifications = M.Notification.query.find().sort('pubdate')
-        n = notifications.all()[3]
-        assert_equal(n.subject, '[test:src] [r1] - rick446: Create readme')
+        n = M.Notification.query.find(
+            dict(subject='[test:src] [r1] - rick446: Create readme')).first()
+        assert n
         assert_equal(n.text, 'Create readme http://localhost//p/test/src/1/')
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d07ea1e8/ForgeUserStats/forgeuserstats/tests/test_stats.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_stats.py b/ForgeUserStats/forgeuserstats/tests/test_stats.py
index 90a467e..482eda8 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_stats.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_stats.py
@@ -40,7 +40,7 @@ class TestStats(TestController):
 
     def test_login(self):
         user = User.by_username('test-user')
-        init_logins = c.user.stats.tot_logins_count
+        init_logins = user.stats.tot_logins_count
         r = self.app.post('/auth/do_login', params=dict(
                 username=user.username, password='foo'))
 
@@ -52,7 +52,7 @@ class TestStats(TestController):
         initial_artifacts = c.user.stats.getArtifacts()
         initial_wiki = c.user.stats.getArtifacts(art_type="Wiki")
 
-        self.app.post('/wiki/TestPage/update', 
+        self.app.post('/wiki/TestPage/update',
             params=dict(title='TestPage', text='some text'),
             extra_environ=dict(username=str(c.user.username)))
 
@@ -64,7 +64,7 @@ class TestStats(TestController):
         assert wiki['created'] == 1 + initial_wiki['created']
         assert wiki['modified'] == initial_wiki['modified']
 
-        self.app.post('/wiki/TestPage2/update', 
+        self.app.post('/wiki/TestPage2/update',
             params=dict(title='TestPage2', text='some text'),
             extra_environ=dict(username=str(c.user.username)))
 
@@ -76,7 +76,7 @@ class TestStats(TestController):
         assert wiki['created'] == 2 + initial_wiki['created']
         assert wiki['modified'] == initial_wiki['modified']
 
-        self.app.post('/wiki/TestPage2/update', 
+        self.app.post('/wiki/TestPage2/update',
             params=dict(title='TestPage2', text='some modified text'),
             extra_environ=dict(username=str(c.user.username)))
 
@@ -93,7 +93,7 @@ class TestStats(TestController):
         initial_tickets = c.user.stats.getTickets()
         initial_tickets_artifacts = c.user.stats.getArtifacts(art_type="Ticket")
 
-        r = self.app.post('/tickets/save_ticket', 
+        r = self.app.post('/tickets/save_ticket',
             params={'ticket_form.summary':'test',
                     'ticket_form.assigned_to' : str(c.user.username)},
             extra_environ=dict(username=str(c.user.username)))
@@ -109,7 +109,7 @@ class TestStats(TestController):
         assert tickets_artifacts['created'] == initial_tickets_artifacts['created'] + 1
         assert tickets_artifacts['modified'] == initial_tickets_artifacts['modified']
 
-        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum, 
+        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum,
             params={'ticket_form.ticket_num' : ticketnum,
                     'ticket_form.summary':'footext3',
                     'ticket_form.status' : 'closed'},
@@ -124,12 +124,12 @@ class TestStats(TestController):
         assert tickets_artifacts['created'] == initial_tickets_artifacts['created'] + 1
         assert tickets_artifacts['modified'] == initial_tickets_artifacts['modified'] + 1
 
-        r = self.app.post('/tickets/save_ticket', 
+        r = self.app.post('/tickets/save_ticket',
             params={'ticket_form.summary':'test2'},
             extra_environ=dict(username=str(c.user.username)))
 
         ticketnum = str(TM.Ticket.query.get(summary='test2').ticket_num)
-        
+
         tickets = c.user.stats.getTickets()
         tickets_artifacts = c.user.stats.getArtifacts(art_type="Ticket")
 
@@ -139,7 +139,7 @@ class TestStats(TestController):
         assert tickets_artifacts['created'] == initial_tickets_artifacts['created'] + 2
         assert tickets_artifacts['modified'] == initial_tickets_artifacts['modified'] + 1
 
-        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum, 
+        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum,
             params={'ticket_form.ticket_num' : ticketnum,
                     'ticket_form.summary':'test2',
                     'ticket_form.assigned_to' : str(c.user.username)},
@@ -147,14 +147,14 @@ class TestStats(TestController):
 
         tickets = c.user.stats.getTickets()
         tickets_artifacts = c.user.stats.getArtifacts(art_type="Ticket")
-        
+
         assert tickets['assigned'] == initial_tickets['assigned'] + 2
         assert tickets['solved'] == initial_tickets['solved'] + 1
         assert tickets['revoked'] == initial_tickets['revoked']
         assert tickets_artifacts['created'] == initial_tickets_artifacts['created'] + 2
         assert tickets_artifacts['modified'] == initial_tickets_artifacts['modified'] + 2
 
-        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum, 
+        r = self.app.post('/tickets/%s/update_ticket_from_widget' % ticketnum,
             params={'ticket_form.ticket_num' : ticketnum,
                     'ticket_form.summary':'test2',
                     'ticket_form.assigned_to' : 'test-user'},
@@ -162,7 +162,7 @@ class TestStats(TestController):
 
         tickets = c.user.stats.getTickets()
         tickets_artifacts = c.user.stats.getArtifacts(art_type="Ticket")
-        
+
         assert tickets['assigned'] == initial_tickets['assigned'] + 2
         assert tickets['solved'] == initial_tickets['solved'] + 1
         assert tickets['revoked'] == initial_tickets['revoked'] + 1


Mime
View raw message