auth_fc: add mapping from gender to title (#84093)
gitea/authentic/pipeline/head This commit looks good Details

This commit is contained in:
Benjamin Dauvergne 2023-11-30 10:31:11 +01:00
parent c0cd751081
commit 6cb3259683
2 changed files with 13 additions and 2 deletions

View File

@ -16,6 +16,8 @@
import sys
from django.utils.translation import pgettext_lazy
class AppSettings:
__SENTINEL = object()
@ -62,6 +64,15 @@ class AppSettings:
'translation': 'notempty',
'if-tag': 'email',
},
'title': {
'ref': 'gender',
'translation': 'simple',
'translation_simple': {
'female': pgettext_lazy('title', 'Mrs'),
'male': pgettext_lazy('title', 'Mr'),
},
'verified': True,
},
},
)

View File

@ -635,13 +635,13 @@ def test_fc_is_down(app, franceconnect, freezer, caplog):
response = franceconnect.login_with_fc(app, path='/accounts/')
assert app.session['_auth_user_id']
app.session.flush()
assert len(caplog.records) == 7
assert len(caplog.records) == 9
# such that 5 minutes later only a warning is emitted
freezer.move_to(datetime.timedelta(seconds=310))
franceconnect.token_endpoint_response = {'status_code': 500, 'content': 'Internal server error'}
response = franceconnect.login_with_fc(app, path='/accounts/')
assert len(caplog.records) == 8
assert len(caplog.records) == 10
assert caplog.records[-1].levelname == 'WARNING'
response = response.maybe_follow()
assert 'Unable to connect to FranceConnect' in response