@@ -212,8 +212,9 @@ class FuzzGetUrls(WsgiSetup, ClientSetup):
212
212
_max_examples = 100
213
213
214
214
@given (sampled_from (['@verbose' , '@page_size' , '@page_index' ]),
215
- one_of ( characters (), text (min_size = 1 ) ))
215
+ text (min_size = 1 ))
216
216
@example ("@verbose" , "1#" )
217
+ @example ("@verbose" , "#1stuff" )
217
218
@settings (max_examples = _max_examples ,
218
219
deadline = 10000 ) # 10000ms
219
220
def test_class_url_param_accepting_integer_values (self , param , value ):
@@ -225,38 +226,42 @@ def test_class_url_param_accepting_integer_values(self, param, value):
225
226
query = '%s=%s' % (param , value )
226
227
f = session .get (url , params = query )
227
228
try :
228
- # test case '0#'
229
- if len (value ) > 1 and value [- 1 ] in ('#' , '&' ):
230
- value = value [:- 1 ]
231
- if int (value ) >= 0 :
229
+ # test case '0#' '12345#stuff' '12345&stuff'
230
+ match = re .match ('(^[0-9]*)[#&]' , value )
231
+ if match is not None :
232
+ value = match [1 ]
233
+ elif int (value ) >= 0 :
232
234
self .assertEqual (f .status_code , 200 )
233
235
except ValueError :
234
- if value in ('#' , '&' ):
236
+ # test case '#' '#0', '&', '&anything here really'
237
+ if value [0 ] in ('#' , '&' ):
235
238
self .assertEqual (f .status_code , 200 )
236
239
else :
237
240
# invalid value for param
238
241
self .assertEqual (f .status_code , 400 )
239
242
240
243
@given (sampled_from (['@verbose' ]), text (min_size = 1 ))
241
- @example ("@verbose" , "1#" )
244
+ @example ("@verbose" , "10#" )
245
+ @example ("@verbose" , u'Ø\U000dd990 ' )
242
246
@settings (max_examples = _max_examples ,
243
247
deadline = 10000 ) # 10000ms
244
248
def test_element_url_param_accepting_integer_values (self , param , value ):
245
- """Tests all integer args for rest url. @page_* is the
246
- same code for all *.
249
+ """Tests args accepting int for rest url.
247
250
"""
248
251
session , _response = self .create_login_session ()
249
252
url = '%s/rest/data/status/1' % (self .url_base ())
250
253
query = '%s=%s' % (param , value )
251
254
f = session .get (url , params = query )
252
255
try :
253
- # test case '0#'
254
- if len (value ) > 1 and value [- 1 ] in ('#' , '&' ):
255
- value = value [:- 1 ]
256
- if int (value ) >= 0 :
256
+ # test case '0#' '12345#stuff' '12345&stuff'
257
+ match = re .match ('(^[0-9]*)[#&]' , value )
258
+ if match is not None :
259
+ value = match [1 ]
260
+ elif int (value ) >= 0 :
257
261
self .assertEqual (f .status_code , 200 )
258
262
except ValueError :
259
- if value in ['#' , '&' ]:
263
+ # test case '#' '#0', '&', '&anything here really'
264
+ if value [0 ] in ('#' , '&' ):
260
265
self .assertEqual (f .status_code , 200 )
261
266
else :
262
267
# invalid value for param
0 commit comments