[tests][BREAK] arguments are not filtered (since version 0.6.20 probably)

This commit is contained in:
Maxime Alves LIRMM@home 2022-09-05 10:12:47 +02:00
parent 5e21d4c24f
commit 039bc2c8fe
2 changed files with 23 additions and 6 deletions

View File

@ -55,18 +55,18 @@ ACLS = {
}
def get(halfapi, data):
def get(data):
"""
description:
returns the configuration of the domain
returns the arguments passed in
"""
logger.error('%s', data['foo'])
return {'foo': data['foo'], 'bar': data['bar']}
return data
def post(halfapi, data):
def post(data):
"""
description:
returns the configuration of the domain
returns the arguments passed in
"""
logger.error('%s', data)
return {'foo': data['foo'], 'bar': data.get('bar', data.get('baz'))}
return data

View File

@ -36,3 +36,20 @@ class TestDummyDomain(TestDomain):
assert res.status_code == 200
assert isinstance(res.content.decode(), str)
assert res.headers['content-type'].split(';')[0] == 'text/html'
def test_arguments__get_routes(self):
arg_dict = {'foo': '1', 'bar': '2', 'x': '3'}
res = self.client.get('/arguments?foo=1&bar=2&x=3')
assert res.json() == arg_dict
res = self.client.get('/arguments?foo=1&bar=2&x=3&y=4')
assert res.json() == arg_dict
def test_arguments_post_routes(self):
arg_dict = {'foo': '1', 'bar': '2', 'baz': '3'}
res = self.client.post('/arguments', arg_dict)
assert res.json() == arg_dict
res = self.client.post('/arguments', { **arg_dict, 'y': '4'})
assert res.json() == arg_dict