| |
@@ -19,6 +19,7 @@
|
| |
}
|
| |
urlencode_data = "terms=test&type=package&match=testmatch"
|
| |
self.fs = FieldStorageCompat({'QUERY_STRING': urlencode_data})
|
| |
+ self.gen_html = mock.patch.object(webidx, '_genHTML').start()
|
| |
|
| |
def __get_server(env):
|
| |
env['koji.form'] = self.fs
|
| |
@@ -29,6 +30,18 @@
|
| |
def tearDown(self):
|
| |
mock.patch.stopall()
|
| |
|
| |
+ def test_no_args(self):
|
| |
+ self.fs = FieldStorageCompat({'QUERY_STRING': ''})
|
| |
+
|
| |
+ webidx.search(self.environ)
|
| |
+
|
| |
+ self.gen_html.assert_called_once()
|
| |
+ # extract values
|
| |
+ # called as _genHTML(environ, 'search.chtml')
|
| |
+ args = self.gen_html.call_args_list[0][0] # no kwargs passed here
|
| |
+ environ = args[0]
|
| |
+ self.assertEqual(environ['koji.values']['terms'], '')
|
| |
+
|
| |
def test_search_exception_match(self):
|
| |
"""Test taskinfo function raises exception"""
|
| |
self.server.getBuildTarget.return_info = None
|
| |
@@ -37,3 +50,7 @@
|
| |
with self.assertRaises(koji.GenericError) as cm:
|
| |
webidx.search(self.environ)
|
| |
self.assertEqual(str(cm.exception), "No such match type: 'testmatch'")
|
| |
+ self.gen_html.assert_not_called()
|
| |
+
|
| |
+
|
| |
+ # the end
|
| |
Prior to python 3.11, parse_qs will error on blank query strings. This change simply skips the call in such a case. Also added a unit test to cover this case.
Fixes https://pagure.io/koji/issue/4332