Mercurial > p > roundup > code
comparison test/test_liveserver.py @ 8290:51f277ed8adc
test: fix fuzz test
CI found a new condition that passes but isn't filtered as passing.
'0 #stuff'
The space is acceptable at the end of a sring otf numbers.
New filter allows this to pass. Added an example of this type of
value.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 18 Jan 2025 19:08:16 -0500 |
| parents | 669dfccca898 |
| children | 0663a7bcef6c |
comparison
equal
deleted
inserted
replaced
| 8289:46886073c665 | 8290:51f277ed8adc |
|---|---|
| 232 | 232 |
| 233 @given(sampled_from(['@verbose', '@page_size', '@page_index']), | 233 @given(sampled_from(['@verbose', '@page_size', '@page_index']), |
| 234 text(min_size=1)) | 234 text(min_size=1)) |
| 235 @example("@verbose", "1#") | 235 @example("@verbose", "1#") |
| 236 @example("@verbose", "#1stuff") | 236 @example("@verbose", "#1stuff") |
| 237 @example("@verbose", "0 #stuff") | |
| 237 @settings(max_examples=_max_examples, | 238 @settings(max_examples=_max_examples, |
| 238 deadline=fuzz_deadline) # in ms | 239 deadline=fuzz_deadline) # in ms |
| 239 def test_class_url_param_accepting_integer_values(self, param, value): | 240 def test_class_url_param_accepting_integer_values(self, param, value): |
| 240 """Tests all integer args for rest url. @page_* is the | 241 """Tests all integer args for rest url. @page_* is the |
| 241 same code for all *. | 242 same code for all *. |
| 243 session, _response = self.create_login_session() | 244 session, _response = self.create_login_session() |
| 244 url = '%s/rest/data/status' % (self.url_base()) | 245 url = '%s/rest/data/status' % (self.url_base()) |
| 245 query = '%s=%s' % (param, value) | 246 query = '%s=%s' % (param, value) |
| 246 f = session.get(url, params=query) | 247 f = session.get(url, params=query) |
| 247 try: | 248 try: |
| 248 # test case '0#' '12345#stuff' '12345&stuff' | 249 # test case '0 #', '0#', '12345#stuff' '12345&stuff' |
| 249 match = re.match('(^[0-9]*)[#&]', value) | 250 match = re.match(r'(^[0-9]*\s*)[#&]', value) |
| 250 if match is not None: | 251 if match is not None: |
| 251 value = match[1] | 252 value = match[1] |
| 252 elif int(value) >= 0: | 253 elif int(value) >= 0: |
| 253 self.assertEqual(f.status_code, 200) | 254 self.assertEqual(f.status_code, 200) |
| 254 except ValueError: | 255 except ValueError: |
