gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: updating infinite stock product


From: gnunet
Subject: [taler-merchant] branch master updated: updating infinite stock product
Date: Mon, 19 Apr 2021 16:07:15 +0200

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

sebasjm pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 14569a57 updating infinite stock product
14569a57 is described below

commit 14569a5703997c14771117da6078f0bd8d8a74df
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Apr 19 11:06:34 2021 -0300

    updating infinite stock product
---
 src/testing/test_merchant_product_creation.sh | 69 +++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/src/testing/test_merchant_product_creation.sh 
b/src/testing/test_merchant_product_creation.sh
new file mode 100755
index 00000000..95ae7044
--- /dev/null
+++ b/src/testing/test_merchant_product_creation.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# This file is in the public domain.
+
+. initialize_taler_system.sh
+
+echo -n "Configuring merchant instance ..."
+STATUS=$(curl -H "Content-Type: application/json" -X POST \
+    -H 'Authorization: Bearer secret-token:super_secret' \
+    http://localhost:9966/private/instances \
+    -d 
'{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost:8082/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 50000},"default_pay_delay":{"d_ms": 60000}}' \
+    -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+    echo 'should respond ok, instance created. got:' $STATUS
+    exit 1
+fi
+echo OK
+RANDOM_IMG='data:image/png;base64,abcdefg'
+
+INFINITE_PRODUCT_TEMPLATE='{"product_id":"2","description":"product with id 2 
and price 
:15","price":"TESTKUDOS:15","total_stock":-1,"description_i18n":{},"unit":"","image":"'$RANDOM_IMG'","taxes":[],"address":{},"next_restock":{"t_ms":"never"}}'
+
+PRODUCT_DATA=$INFINITE_PRODUCT_TEMPLATE
+
+echo -n "Creating product..."
+STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
+    -d "$PRODUCT_DATA" \
+    -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+    echo 'should respond ok, product created. got:' $STATUS
+    exit 1
+fi
+echo OK
+
+PRODUCT_DATA=$(echo $PRODUCT_DATA | jq 'del(.product_id)')
+PRODUCT_DATA=$(echo $PRODUCT_DATA | jq '. + {description: "other 
description"}')
+PRODUCT_DATA=$(echo $PRODUCT_DATA | jq '. + {total_lost: 0}')
+
+# PRODUCT_DATA=$(echo $PRODUCT_DATA | jq '. + {total_stock: 1}')
+
+echo -n "Updating product..."
+STATUS=$(curl 'http://localhost:9966/instances/default/private/products/2' -X 
PATCH \
+    -d "$PRODUCT_DATA" \
+    -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "204" ]
+then
+    echo 'should respond ok, updating product. got:' $STATUS
+    cat $LAST_RESPONSE
+    exit 1
+fi
+
+STATUS=$(curl 'http://localhost:9966/instances/default/private/products/2' \
+    -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+DESCRIPTION=`jq -r .description < $LAST_RESPONSE`
+
+if [ "$DESCRIPTION" != "other description" ]
+then
+    echo 'should change description. got:' $DESCRIPTION
+    cat $LAST_RESPONSE
+    exit 1
+fi
+
+echo OK
+
+exit 0

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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