[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-backoffice] 16/31: testcase
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-backoffice] 16/31: testcase |
Date: |
Thu, 04 Jan 2018 18:09:39 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository backoffice.
commit b5abafccc2326b6abf0c71d2e3f211b4a9c0b47c
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sat Nov 25 10:29:34 2017 +0100
testcase
---
Makefile.in | 2 +-
talerblog/tests.conf | 8 ++++++++
talerblog/tests.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 8504506..a50e280 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48,5 +48,5 @@ install: $(templates) install-data
# run testcases
.PHONY: check
check:
- @export address@hidden@/talersurvey/tests.conf; \
+ @export address@hidden@/talerblog/tests.conf; \
python3 talerblog/tests.py
diff --git a/talerblog/tests.conf b/talerblog/tests.conf
index e69de29..05d3310 100644
--- a/talerblog/tests.conf
+++ b/talerblog/tests.conf
@@ -0,0 +1,8 @@
+[taler]
+CURRENCY = TESTKUDOS
+
+[frontends]
+BACKEND = http://backend.test.taler.net/
+
+[blog]
+INSTANCE = FSF
diff --git a/talerblog/tests.py b/talerblog/tests.py
index e69de29..cf9dbc6 100644
--- a/talerblog/tests.py
+++ b/talerblog/tests.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+
+import unittest
+from mock import patch, MagicMock
+from talerfrontends.blog import blog
+from talerfrontends.talerconfig import TalerConfig
+
+tc = TalerConfig.from_env()
+CURRENCY = tc["taler"]["currency"].value_string(required=True)
+
+class BlogTestCase(unittest.TestCase):
+ def setUp(self):
+ blog.app.testing = True
+ self.app = blog.app.test_client()
+
+ @patch("requests.post")
+ def test_proposal_creation(self, mocked_post):
+ ret_post = MagicMock()
+ ret_post.status_code = 200
+ ret_post.json.return_value = {}
+ mocked_post.return_value = ret_post
+ self.app.get("/generate-contract?nonce=55&article_name=Check_Me")
+ mocked_post.assert_called_with(
+ "http://backend.test.taler.net/proposal",
+ json={
+ "order": {
+ "summary": "Check Me",
+ "nonce": "55",
+ "amount": {
+ "value": 1,
+ "fraction": 0,
+ "currency": CURRENCY},
+ "max_fee": {
+ "value": 1,
+ "fraction": 0,
+ "currency": CURRENCY},
+ "products": [{
+ "description": "Essay: Check Me",
+ "quantity": 1,
+ "product_id": 0,
+ "price": {
+ "value": 1,
+ "fraction": 0,
+ "currency": CURRENCY}}],
+ "fulfillment_url": "http://localhost/essay/Check_Me",
+ "pay_url": "http://localhost/pay",
+ "merchant": {
+ "instance":
tc["blog"]["instance"].value_string(required=True),
+ "address": "nowhere",
+ "name": "Kudos Inc.",
+ "jurisdiction": "none"},
+ "extra": {"article_name": "Check_Me"}}})
+
+if "__main__" == __name__:
+ unittest.main()
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-backoffice] 21/31: linting the launcher, (continued)
- [GNUnet-SVN] [taler-backoffice] 21/31: linting the launcher, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 28/31: survey in side bar, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 14/31: missing templates, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 11/31: actual blog logic, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 05/31: m4, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 09/31: __init__, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 30/31: mock and nose for testing, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 29/31: fix demobar, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 31/31: repo description, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 17/31: right templates dir, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 16/31: testcase,
gnunet <=
- [GNUnet-SVN] [taler-backoffice] 12/31: config parser, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 20/31: mostly linted, gnunet, 2018/01/04
- [GNUnet-SVN] [taler-backoffice] 08/31: adding articles, gnunet, 2018/01/04