tououse-maelis: quality is required on emergency person (#70320)
This commit is contained in:
parent
6fd0cb1d9f
commit
6ba26ee12a
|
@ -554,7 +554,7 @@ FAMILYPERSON_SCHEMA = {
|
|||
'title': 'Family person',
|
||||
'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
|
||||
'type': 'object',
|
||||
'required': ['firstname', 'lastname', 'dateBirth'],
|
||||
'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
|
||||
'properties': {
|
||||
'civility': {
|
||||
'description': 'civilité (depuis référenciel)',
|
||||
|
@ -562,7 +562,8 @@ FAMILYPERSON_SCHEMA = {
|
|||
},
|
||||
'quality': {
|
||||
'description': 'Qualité',
|
||||
'oneOf': [{'type': 'null'}, {'type': 'string'}],
|
||||
'type': 'string',
|
||||
'pattern': '.+',
|
||||
},
|
||||
'sexe': {
|
||||
'description': 'Sexe',
|
||||
|
@ -716,6 +717,7 @@ UPDATE_COORDINATE_SCHEMA = {
|
|||
}
|
||||
|
||||
CHILDPERSON_SCHEMA = copy.deepcopy(FAMILYPERSON_SCHEMA)
|
||||
CHILDPERSON_SCHEMA['required'] = ['firstname', 'lastname', 'dateBirth']
|
||||
del CHILDPERSON_SCHEMA['properties']['quality']
|
||||
|
||||
PERSONQUALITY_SCHEMA = {
|
||||
|
|
|
@ -1697,6 +1697,47 @@ def test_create_person(mocked_post, mocked_get, con, app):
|
|||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_create_person_required_field_error(mocked_post, mocked_get, con, app):
|
||||
mocked_get.return_value = FAMILY_SERVICE_WSDL
|
||||
mocked_post.side_effect = [READ_FAMILY, UPDATE_FAMILY]
|
||||
url = get_endpoint('create-person')
|
||||
params = {
|
||||
'civility': None,
|
||||
'firstname': 'Mathias',
|
||||
'lastname': 'Cassel',
|
||||
'sexe': 'M',
|
||||
'dateBirth': '1972-01-01',
|
||||
'contact/phone': None,
|
||||
'contact/mobile': '0623456789',
|
||||
'contact/mail': None,
|
||||
}
|
||||
|
||||
resp = app.post_json(url + '?NameID=local', params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "'quality' is a required property"
|
||||
|
||||
|
||||
def test_create_person_with_empty_string_on_required_referencial_error(con, app):
|
||||
url = get_endpoint('create-person')
|
||||
params = {
|
||||
'civility': None,
|
||||
'firstname': 'Mathias',
|
||||
'lastname': 'Cassel',
|
||||
'quality': '',
|
||||
'sexe': 'M',
|
||||
'dateBirth': '1972-01-01',
|
||||
'contact/phone': None,
|
||||
'contact/mobile': '0623456789',
|
||||
'contact/mail': None,
|
||||
}
|
||||
|
||||
resp = app.post_json(url + '?NameID=local', params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "quality: '' does not match '.+'"
|
||||
|
||||
|
||||
def test_create_person_not_linked_error(con, app):
|
||||
url = get_endpoint('create-person')
|
||||
params = {
|
||||
|
|
Loading…
Reference in New Issue