mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-24 17:12:29 +00:00
Merge branch '56-exception-when-using-post' into 'master'
Replace algorithm list with a tuple Closes #56 See merge request senpy/senpy!25
This commit is contained in:
commit
f6ca82cac8
@ -175,8 +175,8 @@ def parse_params(indict, *specs):
|
||||
parameters=outdict,
|
||||
errors=wrong_params)
|
||||
raise message
|
||||
if 'algorithm' in outdict and not isinstance(outdict['algorithm'], list):
|
||||
outdict['algorithm'] = list(outdict['algorithm'].split(','))
|
||||
if 'algorithm' in outdict and not isinstance(outdict['algorithm'], tuple):
|
||||
outdict['algorithm'] = tuple(outdict['algorithm'].split(','))
|
||||
return outdict
|
||||
|
||||
|
||||
|
@ -196,7 +196,7 @@ def api_root(plugin):
|
||||
if plugin:
|
||||
plugin = plugin.replace('+', '/')
|
||||
plugin = plugin.split('/')
|
||||
req.parameters['algorithm'] = plugin
|
||||
req.parameters['algorithm'] = tuple(plugin)
|
||||
return current_app.senpy.analyse(req)
|
||||
|
||||
|
||||
|
@ -74,6 +74,7 @@ class BlueprintsTest(TestCase):
|
||||
The results for a POST request should be the same as for a GET request.
|
||||
"""
|
||||
resp = self.client.post("/api/", data={'i': 'My aloha mohame',
|
||||
'algorithm': 'rand',
|
||||
'with_parameters': True})
|
||||
self.assertCode(resp, 200)
|
||||
js = parse_resp(resp)
|
||||
|
Loading…
Reference in New Issue
Block a user