Compare commits

...

4 Commits

Author SHA1 Message Date
Serghei Mihai f1a89c5cd2 clicrdv: fix fiche attribution (#39313)
gitea-wip/passerelle/pipeline/head There was a failure building this commit Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit Details
2020-01-27 23:06:27 +01:00
Frédéric Péters bc2e5d769e tox: limit to xmlschema < 1.1, for Python 2 compatibility 2020-01-27 18:14:00 +01:00
Valentin Deniaud 18b3280447 clicrdv: use correct method when cancelling appointment (#39248) 2020-01-27 18:08:58 +01:00
Valentin Deniaud ed868defcc clicrdv: update appointment request format (#39248) 2020-01-27 18:08:49 +01:00
3 changed files with 16 additions and 12 deletions

View File

@ -136,7 +136,7 @@ class ClicRdv(BaseResource):
def cancel(self, appointment_id, **kwargs):
try:
r = self.request('DELETE', 'appointments/%s' % appointment_id)
r = self.request('appointments/%s' % appointment_id, method='delete')
r.raise_for_status()
except requests.exceptions.HTTPError as e:
# clicrdv will return a "Bad Request" (HTTP 400) response
@ -165,16 +165,18 @@ class ClicRdv(BaseResource):
if websource is None:
websource = self.websource or ''
appointment = {
'fiche': {
'firstname': get_data('clicrdv_firstname') or '-',
'lastname': get_data('clicrdv_lastname') or '-',
'email': get_data('clicrdv_email', ''),
'firstphone': get_data('clicrdv_firstphone', ''),
'secondphone': get_data('clicrdv_secondphone', ''),
},
'date': date,
'intervention_ids': [intervention],
'websource': websource,
'appointment': {
'fiche': {
'firstname': get_data('clicrdv_firstname') or '-',
'lastname': get_data('clicrdv_lastname') or '-',
'email': get_data('clicrdv_email', ''),
'firstphone': get_data('clicrdv_firstphone', ''),
'secondphone': get_data('clicrdv_secondphone', ''),
},
'date': date,
'intervention_ids': [intervention],
'websource': websource,
},
}
comments = get_data('clicrdv_comments') or self.default_comment
if comments:
@ -182,7 +184,7 @@ class ClicRdv(BaseResource):
# optional parameters, if any...
for fieldname in (fields.keys() + extra.keys() + data.keys()):
if fieldname.startswith('clicrdv_fiche_'):
appointment['fiche'][fieldname[14:]] = get_data(fieldname) or ''
appointment['appointment']['fiche'][fieldname[14:]] = get_data(fieldname) or ''
try:
r = self.request('appointments', 'post', json=appointment)
r.raise_for_status()

View File

@ -191,6 +191,7 @@ def test_failed_appointment_creation(mocked_request, app, connector):
apiuser=apiuser)
data = {'fields': {'clicrdv_date_raw': '2017-01-01' , 'clicrdv_time_raw': '12:00:00',
'clicrdv_fiche_str10': 'Test',
'firstname': 'Foo', 'lastname': 'Bar', 'email': 'foobar@example.com'}}
resp = app.post_json('/clicrdv/test/interventions/63258/create?apikey=apiuser', params=data).json
assert resp['data']

View File

@ -36,6 +36,7 @@ deps =
vobject
django-ratelimit
pyquery
xmlschema<1.1
zeep<3.3
commands =
./get_wcs.sh