gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-blog] branch master updated (38478a8 -> b5abafc)


From: gnunet
Subject: [GNUnet-SVN] [taler-blog] branch master updated (38478a8 -> b5abafc)
Date: Sat, 25 Nov 2017 10:29:45 +0100

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

marcello pushed a change to branch master
in repository blog.

    from 38478a8  missing templates
     new bc4886f  typo
     new b5abafc  testcase

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Makefile.in            |  2 +-
 talerblog/blog/blog.py |  2 +-
 talerblog/tests.conf   |  8 ++++++++
 talerblog/tests.py     | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 2 deletions(-)

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/blog/blog.py b/talerblog/blog/blog.py
index 37214f1..c42e9d4 100644
--- a/talerblog/blog/blog.py
+++ b/talerblog/blog/blog.py
@@ -35,7 +35,7 @@ from talerblog.talerconfig import TalerConfig
 from talerblog.helpers import (make_url,
         expect_parameter, join_urlparts, get_query_string,
         backend_error)
-from talerlog.blog.content import (articles,
+from talerblog.blog.content import (articles,
 get_article_file, get_image_file)
 
 logger = logging.getLogger(__name__)
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



reply via email to

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