gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-survey] branch master updated: /pick url gets POSTed


From: gnunet
Subject: [GNUnet-SVN] [taler-survey] branch master updated: /pick url gets POSTed
Date: Tue, 28 Nov 2017 13:14:53 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository survey.

The following commit(s) were added to refs/heads/master by this push:
     new 050e259  /pick url gets POSTed
050e259 is described below

commit 050e259b14649fe2238b627116b88d0778be498e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Nov 28 13:14:36 2017 +0100

    /pick url gets POSTed
---
 talersurvey/survey/survey.py | 7 ++++---
 talersurvey/tests.py         | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/talersurvey/survey/survey.py b/talersurvey/survey/survey.py
index 6fcbbe7..8cfe6cf 100644
--- a/talersurvey/survey/survey.py
+++ b/talersurvey/survey/survey.py
@@ -19,6 +19,7 @@ import os
 import base64
 import requests
 import logging
+import json
 from .amount import Amount
 from talersurvey.talerconfig import TalerConfig
 from urllib.parse import urljoin
@@ -85,7 +86,8 @@ def survey():
     amount = Amount(CURRENCY, 1)
     if flask.request.method == "POST":
         r = requests.post(urljoin(BACKEND_URL, 'tip-authorize'),
-                          json=dict(amount=amount.dump(),
+                          json=dict(pickup_url=urljoin(flask.request.base_url, 
"/pick"),
+                                   amount=amount.dump(),
                                     instance="default",
                                     justification="Payment methods survey"))
         if 200 != r.status_code:
@@ -97,7 +99,6 @@ def survey():
             "templates/wait.html",
            success=success),
        402)
-    tip_header = r.json().update({"pickup_url": 
urljoin(flask.request.base_url, "/pick")})
-    response.headers["X-Taler-Tip"] = json.dumps(tip_header)
+    response.headers["X-Taler-Tip"] = json.dumps(r.json())
 
     return response
diff --git a/talersurvey/tests.py b/talersurvey/tests.py
index 4f4e4e2..0c7c9dc 100644
--- a/talersurvey/tests.py
+++ b/talersurvey/tests.py
@@ -22,11 +22,11 @@ class SurveyTestCase(unittest.TestCase):
             "exchange_uri": "http://exchange.example.com/";,
             "expiration": "/Date(2018)/"}
         mocked_post.return_value = ret_post
-        # Actual preference's ignored.
         self.app.post("/")
         mocked_post.assert_called_with(
             "http://backend.test.taler.net/tip-authorize";,
             json={
+               "pickup_url": "http://localhost/pick";,
                 "amount": {
                     "value": 1,
                     "fraction": 0,
@@ -40,12 +40,12 @@ class SurveyTestCase(unittest.TestCase):
         ret_post.status_code = 200
         ret_post.json.return_value = {}
         mocked_post.return_value = ret_post
-        self.app.post("/pick?tip_id=44",
+        self.app.post("/pick",
                       data="{}",
                       content_type="application/json")
         mocked_post.assert_called_with(
             "http://backend.test.taler.net/tip-pickup";,
-            json={"tip_id": "44"})
+           json={})
 
 if __name__ == "__main__":
     unittest.main()

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]