From af77f8a1cd3b75ba300993ca1bf0104920d4b3b2 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 18 Jan 2018 18:59:31 +0100 Subject: remove wait page, fix syntax/import --- talersurvey/survey/survey.py | 3 +-- talersurvey/survey/templates/wait.html | 7 ------- talersurvey/tests.py | 36 ---------------------------------- 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 talersurvey/survey/templates/wait.html (limited to 'talersurvey') diff --git a/talersurvey/survey/survey.py b/talersurvey/survey/survey.py index d068f66..9b58572 100644 --- a/talersurvey/survey/survey.py +++ b/talersurvey/survey/survey.py @@ -22,7 +22,6 @@ from urllib.parse import urljoin import flask import requests from ..talerconfig import TalerConfig -from .amount import Amount BASE_DIR = os.path.dirname(os.path.abspath(__file__)) app = flask.Flask(__name__, template_folder=BASE_DIR) @@ -91,7 +90,7 @@ def submit_survey(): resp = backend_post("tip-authorize", tip_spec) if resp.get("tip_redirect_url"): - flask.redirect(resp["tip_redirect_url"] + flask.redirect(resp["tip_redirect_url"]) err_abort(500, message="Tipping failed, unexpected backend response", json=resp) diff --git a/talersurvey/survey/templates/wait.html b/talersurvey/survey/templates/wait.html deleted file mode 100644 index 81dd36a..0000000 --- a/talersurvey/survey/templates/wait.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "templates/base.html" %} - -{% block main %} -

- Please wait while the tip is being generated.. -

-{% endblock %} diff --git a/talersurvey/tests.py b/talersurvey/tests.py index 437a8d3..7dc2446 100644 --- a/talersurvey/tests.py +++ b/talersurvey/tests.py @@ -14,41 +14,5 @@ class SurveyTestCase(unittest.TestCase): survey.app.testing = True self.app = survey.app.test_client() - @patch("requests.post") - def test_authorize(self, mocked_post): - ret_post = MagicMock() - ret_post.status_code = 200 - ret_post.json.return_value = { - "tip_id": "Jeppo02", - "tip_token": "mytiptoken", - "exchange_uri": "http://exchange.example.com/", - "expiration": "/Date(2018)/"} - mocked_post.return_value = ret_post - self.app.post("/submit-survey") - mocked_post.assert_called_with( - "http://backend.test.taler.net/tip-authorize", - json={ - "pickup_url": "http://localhost/tip-pickup", - "next_url": os.environ.get("TALER_ENV_URL_INTRO", "https://taler.net/"), - "amount": { - "value": 1, - "fraction": 0, - "currency": CURRENCY}, - "instance": "default", - "justification": "Payment methods survey"}) - - @patch("requests.post") - def test_pick(self, mocked_post): - ret_post = MagicMock() - ret_post.status_code = 200 - ret_post.json.return_value = {} - mocked_post.return_value = ret_post - self.app.post("/tip-pickup", - data="{}", - content_type="application/json") - mocked_post.assert_called_with( - "http://backend.test.taler.net/tip-pickup", - json={}) - if __name__ == "__main__": unittest.main() -- cgit v1.2.3