rsa13: allow empty email fields (#53611)

This commit is contained in:
Benjamin Dauvergne 2021-04-30 15:15:59 +02:00
parent 7104b261b3
commit f1a8b5ac25
2 changed files with 17 additions and 3 deletions

View File

@ -303,7 +303,7 @@ class RSA13Resource(BaseResource, HTTPResource):
'email': {
'type': 'string',
'maxLength': 78,
'pattern': '^.*@.*$',
'pattern': '^(.*@.*)?$',
},
'nom': {
'type': 'string',
@ -404,7 +404,7 @@ class RSA13Resource(BaseResource, HTTPResource):
'email': {
'type': 'string',
'maxLength': 78,
'pattern': '^.*@.*$',
'pattern': '^(.*@.*)?$',
},
'nom': {
'type': 'string',
@ -902,7 +902,7 @@ class RSA13Resource(BaseResource, HTTPResource):
'properties': {
'courriel': {
'type': 'string',
'pattern': '^.*@.*$',
'pattern': '^(.*@.*)?$',
},
'commentaire': {
'type': 'string',

View File

@ -207,6 +207,20 @@ def test_platform_referent_post(app, rsa13, url):
assert response.json == {'err': 0}
@mock_response(['/api/platform/11/referent/', {'err': 0}])
def test_platform_referent_post_empty_mail_and_tel(app, rsa13, url):
response = app.post_json(
url + 'platform/11/referent/',
params={
'email': '',
'prenom': 'John',
'nom': 'Doe',
'tel': '',
},
)
assert response.json == {'err': 0}
@mock_response(['/api/platform/11/referent/1/', {'err': 0}])
def test_platform_referent_update(app, rsa13, url):
response = app.post_json(