api/ants: fix setting of last_upload (#83553)
gitea/ants-hub/pipeline/head This commit looks good
Details
gitea/ants-hub/pipeline/head This commit looks good
Details
This commit is contained in:
parent
498febe19c
commit
455218cdc0
|
@ -59,7 +59,7 @@ def push_rdv(rdv):
|
|||
timeout=10,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()['success'] == 'true'
|
||||
return response.json()['success']
|
||||
else:
|
||||
params = [
|
||||
('application_id', identifiant_predemande),
|
||||
|
@ -74,7 +74,7 @@ def push_rdv(rdv):
|
|||
timeout=10,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()['rowcount'] == 1
|
||||
return 'rowcount' in response.json()
|
||||
except requests.HTTPError as e:
|
||||
if e.response.status_code == 422:
|
||||
raise ANTSError(str(e), e.response.json())
|
||||
|
@ -104,8 +104,7 @@ def upload_rdvs():
|
|||
try:
|
||||
if push_rdv(rdv):
|
||||
logger.info('pushed rdv(%s) of lieu %s', rdv, rdv.lieu)
|
||||
rdv.last_upload = start
|
||||
rdv.save()
|
||||
RendezVous.objects.filter(pk=rdv.pk).update(last_upload=start)
|
||||
except ANTSError as e:
|
||||
logger.warning('unable to push rdv(%s) of lieu %s: %r', rdv, rdv.lieu, e)
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ class TestAPIV2Push:
|
|||
post_response = responses.add(
|
||||
responses.POST,
|
||||
'https://api-coordination.rendezvouspasseport.ants.gouv.fr/api/appointments',
|
||||
json={'success': 'true'},
|
||||
json={'success': True},
|
||||
status=200,
|
||||
match=[responses.matchers.header_matcher({'x-rdv-opt-auth-token': 'abcd'})],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue