api: add always_advertise attribute in /api/formdefs/ response (#46051)

This commit is contained in:
Frédéric Péters 2020-08-25 10:31:58 +02:00
parent 90834b9402
commit ab485f0f3e
2 changed files with 5 additions and 2 deletions

View File

@ -360,7 +360,8 @@ def test_formdef_list(pub):
assert resp1.json == resp2.json == resp3.json assert resp1.json == resp2.json == resp3.json
assert resp1.json['data'][0]['title'] == 'test' assert resp1.json['data'][0]['title'] == 'test'
assert resp1.json['data'][0]['url'] == 'http://example.net/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]['description'] == 'plop'
assert resp1.json['data'][0]['keywords'] == ['mobile', 'test'] assert resp1.json['data'][0]['keywords'] == ['mobile', 'test']
assert list(resp1.json['data'][0]['functions'].keys()) == ['_receiver'] assert list(resp1.json['data'][0]['functions'].keys()) == ['_receiver']

View File

@ -505,7 +505,9 @@ class ApiFormdefsDirectory(Directory):
'url': formdef.get_url(), 'url': formdef.get_url(),
'description': formdef.description or '', 'description': formdef.description or '',
'keywords': formdef.keywords_list, 'keywords': formdef.keywords_list,
'authentication_required': authentication_required} 'authentication_required': authentication_required,
'always_advertise': formdef.always_advertise,
}
if formdef.required_authentication_contexts: if formdef.required_authentication_contexts:
formdict['required_authentication_contexts'] = formdef.required_authentication_contexts formdict['required_authentication_contexts'] = formdef.required_authentication_contexts
if backoffice_submission: if backoffice_submission: