[PATCH 3 of 5 timesheet] [test] Requests parameters must now be given directly to the request

Simon Chabot simon.chabot at logilab.fr
Thu Mar 5 16:16:55 CET 2020


# HG changeset patch
# User Simon Chabot <simon.chabot at logilab.fr>
# Date 1583404154 -3600
#      Thu Mar 05 11:29:14 2020 +0100
# Node ID 65e3d47131cb2b1999e9f8a59e92c6ff3684581c
# Parent  5fcde88ecac1cd1b829a7033bbc8f948f62a5c35
# Available At https://hg.logilab.org/review/cubes/timesheet/
#              hg pull https://hg.logilab.org/review/cubes/timesheet/ -r 65e3d47131cb
[test] Requests parameters must now be given directly to the request

In the tests, to trigger the expected view from the URL, the requests parameters
must be given to the requests directly, and the app handler should be called
to be obtain the results.

diff -r 5fcde88ecac1 -r 65e3d47131cb test/unittest_json.py
--- a/test/unittest_json.py	Thu Mar 05 11:21:36 2020 +0100
+++ b/test/unittest_json.py	Thu Mar 05 11:29:14 2020 +0100
@@ -30,11 +30,14 @@
 
     def test_get_daytypes(self):
         """test daytypes.json web service"""
-        with self.admin_access.web_request() as req:
-            daytypes_url = req.build_url('view',
-                                         login=u'testuser', vid='daytypes.json',
-                                         start='2014-04-28', stop='2014-05-05')
-            response = self.url_publish(daytypes_url)
+        with self.admin_access.web_request(
+            url="view",
+            login="testuser",
+            start="2014-04-28",
+            stop="2014-05-05",
+            vid="daytypes.json",
+        ) as req:
+            response = self.app_handle_request(req)
             self.assertEqual(json.loads(response),
                              [[u'2014-04-28', u'dt_working'],
                               [u'2014-04-29', u'dt_working'],



More information about the cubicweb-devel mailing list