grenoble_gru: cleanup phone numbers (#78187)
gitea/passerelle/pipeline/head This commit looks good Details

This commit is contained in:
Serghei Mihai 2023-06-06 10:44:54 +02:00
parent 2cac256517
commit 166d58591a
2 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,11 @@ class GrenobleGRU(BaseResource):
payload = {'id': data['application_id']}
payload['dem_comp'] = types_params['dem_comp'] = data.get('dem_comp', 'Voirie')
for key, value in data.items():
if key.endswith('_phone'):
phone = ''.join(x for x in value if x in '0123456789')
data[key] = phone
payload.update(
{
# applicant informations

View File

@ -229,6 +229,7 @@ def test_demand_creation_params(app, setup):
payload = BASIC_PAYLOAD.copy()
payload['intervention_free_address'] = '169, rue du Château'
payload['applicant_free_address'] = '1, rue de l\'Est'
payload['applicant_phone'] = '01-02.03 04 05'
app.post_json(
reverse(
'generic-endpoint',
@ -243,6 +244,7 @@ def test_demand_creation_params(app, setup):
assert request_post.call_args[1]['data']['dem_pav'] == 'déchetterie'
assert request_post.call_args[1]['data']['dem_reponse'] == 0
assert request_post.call_args[1]['data']['obs_description_probleme'] == 'thank you '
assert request_post.call_args[1]['data']['dem_tel'] == '0102030405'
payload['applicant_requires_reply'] = True
payload['urgent_demand'] = 'True'