Projet

Général

Profil

Development #51842

greco, permettre de passer un application_id dans l'appel create

Ajouté par Frédéric Péters il y a environ 3 ans. Mis à jour il y a environ 3 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
09 mars 2021
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Aujourd'hui on a un paramétrage avec un "id d'application" au niveau du connecteur; on voudrait pouvoir optionnellement faire varier celui-ci lors de l'appel de création d'une demande,

    def create(self, request):
[...]
        creation.application = self.application

(#51731#note-7)


Fichiers


Demandes liées

Lié à Passerelle - Development #51733: Nouvelle version du connecteur GRECOFermé05 mars 2021

Actions

Révisions associées

Révision 76946f7c (diff)
Ajouté par Nicolas Roche il y a environ 3 ans

greco: add support for passing application id to create endpoint (#51842)

Historique

#3

Mis à jour par Nicolas Roche il y a environ 3 ans

#4

Mis à jour par Nicolas Roche il y a environ 3 ans

#5

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Solution proposée à Solution validée

Ça m'intéresserait d'avoir un appel où le nouveau paramètre n'est pas envoyé, histoire d'être sûr que celui défini au niveau du modèle soit bien utilisé.

(...)

Je viens de le faire,

+@mock.patch('passerelle.utils.Request.post', side_effect=(TOKEN, CREATE_OK))
+def test_greco_create_ok_no_application(mocked_post, app, conn):
+    url = reverse('generic-endpoint', kwargs={'connector': 'greco', 'endpoint': 'create', 'slug': conn.slug})
+    url += '?apikey=grecokey'
+
+    payload = copy.copy(CREATE_PAYLOAD)
+    del payload['application']
+    resp = app.post_json(url, params=payload)
+    assert mocked_post.call_count == 2
+
+    def to_json(root):
+        tag = root.tag[root.tag.find('}') + 1 :]
+        if len(root) == 0:  # text node
+            return {tag: root.text or None}
+        childs = {}
+        for child in root:
+            childs.update(to_json(child))
+        return {tag: childs or None}
+
+    call_args = to_json(ET.fromstring(mocked_post.call_args[1]['data']))
+    demande_creation = call_args['Envelope']['Body']['creer']['demandeCreation']
+    assert demande_creation['application'] == 'appid'

poussé dans la branche (dans le commit de ce ticket).

#6

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 76946f7cb190ed913330d8826ef20f0ee085b664
Author: Nicolas ROCHE <nroche@entrouvert.com>
Date:   Tue Mar 9 17:55:59 2021 +0100

    greco: add support for passing application id to create endpoint (#51842)

(merci Nicolas pour tous les patchs, j'ai intégré histoire de gérer la publication en recette aujourd'hui).

#7

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF