@@ -212,8 +212,9 @@ class FuzzGetUrls(WsgiSetup, ClientSetup):
212212 _max_examples = 100
213213
214214 @given (sampled_from (['@verbose' , '@page_size' , '@page_index' ]),
215- one_of ( characters (), text (min_size = 1 ) ))
215+ text (min_size = 1 ))
216216 @example ("@verbose" , "1#" )
217+ @example ("@verbose" , "#1stuff" )
217218 @settings (max_examples = _max_examples ,
218219 deadline = 10000 ) # 10000ms
219220 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):
225226 query = '%s=%s' % (param , value )
226227 f = session .get (url , params = query )
227228 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 :
232234 self .assertEqual (f .status_code , 200 )
233235 except ValueError :
234- if value in ('#' , '&' ):
236+ # test case '#' '#0', '&', '&anything here really'
237+ if value [0 ] in ('#' , '&' ):
235238 self .assertEqual (f .status_code , 200 )
236239 else :
237240 # invalid value for param
238241 self .assertEqual (f .status_code , 400 )
239242
240243 @given (sampled_from (['@verbose' ]), text (min_size = 1 ))
241- @example ("@verbose" , "1#" )
244+ @example ("@verbose" , "10#" )
245+ @example ("@verbose" , u'Ø\U000dd990 ' )
242246 @settings (max_examples = _max_examples ,
243247 deadline = 10000 ) # 10000ms
244248 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.
247250 """
248251 session , _response = self .create_login_session ()
249252 url = '%s/rest/data/status/1' % (self .url_base ())
250253 query = '%s=%s' % (param , value )
251254 f = session .get (url , params = query )
252255 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 :
257261 self .assertEqual (f .status_code , 200 )
258262 except ValueError :
259- if value in ['#' , '&' ]:
263+ # test case '#' '#0', '&', '&anything here really'
264+ if value [0 ] in ('#' , '&' ):
260265 self .assertEqual (f .status_code , 200 )
261266 else :
262267 # invalid value for param
0 commit comments