aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c9
-rwxr-xr-xsrc/testing/test_merchant_instance_creation.sh70
-rwxr-xr-xsrc/testing/test_merchant_order_creation.sh2
3 files changed, 77 insertions, 4 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
index 71be2673..0ab7fce6 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -453,8 +453,13 @@ retry:
TMH_reload_instances (mi->settings.id);
}
GNUNET_JSON_parse_free (spec);
- GNUNET_free (TMH_default_auth); /* clear it: user just either created default
- instance or it should already be NULL */
+ if (0 == strcmp (is.id,
+ "default"))
+ {
+ GNUNET_free (TMH_default_auth); /* clear it if the default instance was
+ created */
+ }
+
return TALER_MHD_reply_static (connection,
MHD_HTTP_NO_CONTENT,
NULL,
diff --git a/src/testing/test_merchant_instance_creation.sh b/src/testing/test_merchant_instance_creation.sh
new file mode 100755
index 00000000..04410a56
--- /dev/null
+++ b/src/testing/test_merchant_instance_creation.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+# This file is part of TALER
+# Copyright (C) 2014-2021 Taler Systems SA
+#
+# TALER is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3, or
+# (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with TALER; see the file COPYING. If not, see
+# <http://www.gnu.org/licenses/>
+#
+
+. initialize_taler_system.sh
+
+
+echo -n "Configuring a merchant instance before configuring the default instance ..."
+
+STATUS=$(curl -H "Content-Type: application/json" -X POST \
+ http://localhost:9966/management/instances \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"first","name":"test","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" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' \
+ -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+ echo 'should respond ok, instance created. got:' $STATUS
+ exit 1
+fi
+
+echo " OK"
+
+echo -n "Configuring default instance ..."
+
+STATUS=$(curl -H "Content-Type: application/json" -X POST \
+ -H 'Authorization: Bearer secret-token:super_secret' \
+ http://localhost:9966/management/instances \
+ -d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost/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" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' \
+ -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+ echo 'should respond ok, instance created. got:' $STATUS
+ exit 1
+fi
+
+echo " OK"
+
+echo -n "Configuring a second merchant instance ..."
+
+STATUS=$(curl -H "Content-Type: application/json" -X POST \
+ http://localhost:9966/management/instances \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"second","name":"test","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" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' \
+ -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+ echo 'should respond ok, instance created. got:' $STATUS
+ exit 1
+fi
+
+echo " OK"
+
+
+exit 0
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh
index 04ee34ea..3ab07406 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -3,8 +3,6 @@
set -eu
-set -x
-
. initialize_taler_system.sh
echo -n "First prepare wallet with coins..."