From 30c94dd4664af6025e15dce1fa196ec938c2c2b7 Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Fri, 1 Sep 2023 15:38:34 +0200 Subject: [PATCH] Added endpoint and test to help debug argument passing --- api.py | 4 ++++ tests/test_api.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/api.py b/api.py index ea23b59e..d130b063 100644 --- a/api.py +++ b/api.py @@ -18,6 +18,10 @@ def startup(): def read_root(): return {'success': True} +@app.put('/bounce_back') +def read_root(par1=None, par2=None): + return {'success': True, 'params': {'par1': par1, 'par2': par2}} + @app.get('/models') def list_active_models(): return session.describe_loaded_models() diff --git a/tests/test_api.py b/tests/test_api.py index e4091cb2..ae2529f8 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -41,6 +41,12 @@ class TestApiFromAutomatedClient(TestServerBaseClass): resp = requests.get(self.uri, ) self.assertEqual(resp.status_code, 200) + def test_bounceback_parameters(self): + resp = requests.put(self.uri + 'bounce_back', params={'par1': 'hello'}) + self.assertEqual(resp.status_code, 200, resp.json()) + self.assertEqual(resp.json()['params']['par1'], 'hello', resp.json()) + self.assertEqual(resp.json()['params']['par2'], None, resp.json()) + def test_list_empty_loaded_models(self): resp = requests.get(self.uri + 'models') self.assertEqual(resp.status_code, 200) -- GitLab