You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/12 19:08:58 UTC

[3/4] git commit: [#4504] ticket:311 Test for $USER variable in ticket searches

[#4504] ticket:311 Test for $USER variable in ticket searches


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

Branch: refs/heads/master
Commit: 6f045479527c2444193c43d1d7d6e583402413ee
Parents: c794904
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Apr 9 09:02:12 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 12 17:07:49 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   21 +++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6f045479/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 ed03410..cef0134 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -816,6 +816,27 @@ class TestFunctionalController(TrackerTestController):
         response = self.app.get('/p/test/bugs/search_feed.atom?q=test')
         assert '<title>test first ticket</title>' in response
 
+    def test_search_current_user(self):
+        self.new_ticket(summary='test first ticket')
+        self.new_ticket(summary='test second ticket')
+        p = M.Project.query.get(shortname='test')
+        tracker = p.app_instance('bugs')
+        t = tm.Ticket.query.get(summary='test first ticket')
+        t.reported_by_id = M.User.by_username('test-user-0')._id
+        t = tm.Ticket.query.get(summary='test second ticket')
+        t.reported_by_id = M.User.by_username('test-user-1')._id
+        ThreadLocalORMSession.flush_all()
+        M.MonQTask.run_ready()
+        ThreadLocalORMSession.flush_all()
+        response = self.app.get('/p/test/bugs/search/?q=reported_by_s:$USER',
+                                extra_environ={'username': 'test-user-0'})
+        assert '1 result' in response, response.showbrowser()
+        assert 'test first ticket' in response, response.showbrowser()
+        response = self.app.get('/p/test/bugs/search/?q=reported_by_s:$USER',
+                                extra_environ={'username': 'test-user-1'})
+        assert '1 result' in response, response.showbrowser()
+        assert 'test second ticket' in response, response.showbrowser()
+
     def test_feed(self):
         self.new_ticket(
             summary='test first ticket',