From ab485f0f3e5cb4b3a6868f5ca82f7ddaa885c6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 25 Aug 2020 10:31:58 +0200 Subject: [PATCH] api: add always_advertise attribute in /api/formdefs/ response (#46051) --- tests/test_api.py | 3 ++- wcs/api.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index d53e37883..5afd6efdf 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -360,7 +360,8 @@ def test_formdef_list(pub): assert resp1.json == resp2.json == resp3.json assert resp1.json['data'][0]['title'] == 'test' assert resp1.json['data'][0]['url'] == 'http://example.net/test/' - assert resp1.json['data'][0]['redirection'] == False + assert resp1.json['data'][0]['redirection'] is False + assert resp1.json['data'][0]['always_advertise'] is False assert resp1.json['data'][0]['description'] == 'plop' assert resp1.json['data'][0]['keywords'] == ['mobile', 'test'] assert list(resp1.json['data'][0]['functions'].keys()) == ['_receiver'] diff --git a/wcs/api.py b/wcs/api.py index eada5df4c..42872d4b5 100644 --- a/wcs/api.py +++ b/wcs/api.py @@ -505,7 +505,9 @@ class ApiFormdefsDirectory(Directory): 'url': formdef.get_url(), 'description': formdef.description or '', 'keywords': formdef.keywords_list, - 'authentication_required': authentication_required} + 'authentication_required': authentication_required, + 'always_advertise': formdef.always_advertise, + } if formdef.required_authentication_contexts: formdict['required_authentication_contexts'] = formdef.required_authentication_contexts if backoffice_submission: