From 039bc2c8febc412e764553f04f0b4f9298cc828c Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Mon, 5 Sep 2022 10:12:47 +0200 Subject: [PATCH] [tests][BREAK] arguments are not filtered (since version 0.6.20 probably) --- .../dummy_domain/routers/arguments/__init__.py | 12 ++++++------ tests/test_domain.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/tests/dummy_domain/routers/arguments/__init__.py b/tests/dummy_domain/routers/arguments/__init__.py index 81f6c42..1a999f2 100644 --- a/tests/dummy_domain/routers/arguments/__init__.py +++ b/tests/dummy_domain/routers/arguments/__init__.py @@ -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 diff --git a/tests/test_domain.py b/tests/test_domain.py index d3ad4f9..1c873bb 100644 --- a/tests/test_domain.py +++ b/tests/test_domain.py @@ -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