diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-18 18:59:31 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-18 18:59:31 +0100 |
commit | af77f8a1cd3b75ba300993ca1bf0104920d4b3b2 (patch) | |
tree | ab68b23d35c6b3165b8dbcdf099d3702437058ce | |
parent | 62118eb9531e11c38cc6cebb1cc2f7255d755ffc (diff) | |
download | survey-af77f8a1cd3b75ba300993ca1bf0104920d4b3b2.tar.gz survey-af77f8a1cd3b75ba300993ca1bf0104920d4b3b2.tar.bz2 survey-af77f8a1cd3b75ba300993ca1bf0104920d4b3b2.zip |
remove wait page, fix syntax/import
-rw-r--r-- | talersurvey/survey/survey.py | 3 | ||||
-rw-r--r-- | talersurvey/survey/templates/wait.html | 7 | ||||
-rw-r--r-- | talersurvey/tests.py | 36 |
3 files changed, 1 insertions, 45 deletions
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 %} - <p> - Please wait while the tip is being generated.. - </p> -{% 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() |