tests/passerelle: add parameters to post #6577
This commit is contained in:
parent
b8558df442
commit
e11eadf12f
|
@ -0,0 +1,40 @@
|
||||||
|
From db6a038ab98f828fa3c478c41449068a328f1e9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thomas NOEL <tnoel@entrouvert.com>
|
||||||
|
Date: Thu, 19 Mar 2015 13:29:37 +0100
|
||||||
|
Subject: [PATCH] bdp: add parameters to post/adherent (#6577)
|
||||||
|
|
||||||
|
---
|
||||||
|
passerelle/apps/bdp/views.py | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/passerelle/apps/bdp/views.py b/passerelle/apps/bdp/views.py
|
||||||
|
index ddced57..4f13826 100644
|
||||||
|
--- a/passerelle/apps/bdp/views.py
|
||||||
|
+++ b/passerelle/apps/bdp/views.py
|
||||||
|
@@ -50,6 +50,12 @@ class PostAdherentView(View, SingleObjectMixin):
|
||||||
|
date_de_naissance = data['fields'].get('date_de_naissance')
|
||||||
|
# force 1973-04-18T00:00:00Z
|
||||||
|
date_de_naissance = date_de_naissance[:10] + 'T00:00:00Z'
|
||||||
|
+ abonnements = data['fields'].get('abonnements_raw') or \
|
||||||
|
+ data['fields'].get('abonnements_raw') or \
|
||||||
|
+ request.GET.get('abonnements')
|
||||||
|
+ bibliotheque_id = data['fields'].get('bibliotheque_raw') or \
|
||||||
|
+ data['fields'].get('bibliotheque') or \
|
||||||
|
+ request.GET.get('bibliotheque')
|
||||||
|
adherent = {
|
||||||
|
'nom': data['fields'].get('nom'),
|
||||||
|
'prenom': data['fields'].get('prenom'),
|
||||||
|
@@ -57,8 +63,8 @@ class PostAdherentView(View, SingleObjectMixin):
|
||||||
|
'hashpass': data['fields'].get('mot_de_passe').get('cleartext'),
|
||||||
|
'dateNaissance': date_de_naissance,
|
||||||
|
'actif': 'on',
|
||||||
|
- 'bibliotheque': {'id': data['fields'].get('bibliotheque_raw')},
|
||||||
|
- 'abonnements': '15',
|
||||||
|
+ 'bibliotheque': {'id': bibliotheque_id},
|
||||||
|
+ 'abonnements': abonnements,
|
||||||
|
}
|
||||||
|
return self.get_object().post_api('adherents', adherent)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.1.4
|
||||||
|
|
|
@ -28,6 +28,7 @@ Source5: synchro-cron.sh
|
||||||
Source6: wcs-au-quotidien.cron.d
|
Source6: wcs-au-quotidien.cron.d
|
||||||
Source7: passerelle-manage
|
Source7: passerelle-manage
|
||||||
Source8: cg14_config.py
|
Source8: cg14_config.py
|
||||||
|
Patch1: 0001-bdp-add-parameters-to-post-adherent-6577.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
@ -39,6 +40,7 @@ Passerelle provides an uniform access to multiple data sources and services.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n passerelle-%{commit}
|
%setup -q -n passerelle-%{commit}
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
getent group passerelle >/dev/null || groupadd -r passerelle
|
getent group passerelle >/dev/null || groupadd -r passerelle
|
||||||
|
|
Reference in New Issue