grenoble-gru: ignore string values for PAV "adresse" field (#52527)
This commit is contained in:
parent
979e7e60f7
commit
42b061105f
|
@ -211,10 +211,13 @@ class GrenobleGRU(BaseResource):
|
|||
@endpoint(perm='can_access', description=_('Lists PAVs'))
|
||||
def pavs(self, request, *args, **kwargs):
|
||||
response = self.request('ws_recuperation_pav.php')
|
||||
data = response.json()
|
||||
for item in data:
|
||||
data = []
|
||||
for item in response.json():
|
||||
if not isinstance(item['adresse'], dict):
|
||||
continue
|
||||
item['id'] = str(item['id'])
|
||||
item['text'] = '{numero_voie}, {nom_voie}, {commune}'.format(**item['adresse'])
|
||||
data.append(item)
|
||||
return {'data': data}
|
||||
|
||||
@endpoint(name='create-demand', perm='can_access', methods=['post'], description=_('Create a demand'))
|
||||
|
|
|
@ -138,5 +138,19 @@
|
|||
"id": 61,
|
||||
"actif": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"numero": "9",
|
||||
"actif": true,
|
||||
"adresse": "None",
|
||||
"secteur": {
|
||||
"libelle": "Grand Sud"
|
||||
},
|
||||
"Type de Dysfonctionnement": {
|
||||
"libelle": "PAV A\u00e9rien Verre",
|
||||
"id": 61,
|
||||
"actif": true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -368,6 +368,7 @@ def test_get_pavs(app, setup):
|
|||
)
|
||||
)
|
||||
assert response.json['err'] == 0
|
||||
assert len(response.json['data']) == 7
|
||||
for item in response.json['data']:
|
||||
assert isinstance(item['id'], str)
|
||||
assert item['text']
|
||||
|
|
Loading…
Reference in New Issue