changeset 7937:22354d7fc94a

test: issue1525113 - notation to filter by logged-in user Add a test_liveserver test of a @current_user query. Maybe this will catch the templating change somehow??
author John Rouillard <rouilj@ieee.org>
date Mon, 06 May 2024 01:25:27 -0400
parents a9b136565838
children ce5a554b2f88
files test/test_liveserver.py
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_liveserver.py	Mon May 06 00:49:43 2024 -0400
+++ b/test/test_liveserver.py	Mon May 06 01:25:27 2024 -0400
@@ -176,6 +176,37 @@
             return session
         return session, response
 
+
+    def test_query(self):
+        current_user_query = (
+            "@columns=title,id,activity,status,assignedto&"
+            "@sort=activity&@group=priority&@filter=creator&"
+            "@pagesize=50&@startwith=0&creator=%40current_user&"
+            "@dispname=Test1")
+
+        session, _response = self.create_login_session()
+        f = session.get(self.url_base()+'/issue?' + current_user_query)
+
+        # verify the query has run by looking for the query name
+        self.assertIn('List of issues\n   - Test1', f.text)
+        # find title of issue 1
+        self.assertIn('foo bar RESULT', f.text)
+        # match footer "1..1 out of 1" if issue is found
+        self.assertIn('out of', f.text)
+        # logout
+        f = session.get(self.url_base()+'/?@action=logout')
+
+
+        # set up for another user
+        session, _response = self.create_login_session(username="fred")
+        f = session.get(self.url_base()+'/issue?' + current_user_query)
+
+        # verify the query has run
+        self.assertIn('List of issues\n   - Test1', f.text)
+        # We should have no rows, so verify the static part
+        # of the footer is missing.
+        self.assertNotIn('out of', f.text)
+
     def test_start_page(self):
         """ simple test that verifies that the server can serve a start page.
         """

Roundup Issue Tracker: http://roundup-tracker.org/