summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-02-02 15:07:24 +0100
committerChristian Grothoff <christian@grothoff.org>2021-02-02 15:07:24 +0100
commit068433c5e7c99866a58d6be146fe25b36bb4d5b8 (patch)
treeff7b102d567a96c0bd83b38b6e5e22b5d8d67168 /src/testing
parent96726fd5ab6dc067af4957c3d1826f9fd2745c95 (diff)
downloadmerchant-068433c5e7c99866a58d6be146fe25b36bb4d5b8.tar.gz
merchant-068433c5e7c99866a58d6be146fe25b36bb4d5b8.tar.bz2
merchant-068433c5e7c99866a58d6be146fe25b36bb4d5b8.zip
add rudimentary test logic for #6731
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_merchant_api.c37
-rw-r--r--src/testing/testing_api_cmd_patch_instance.c5
-rw-r--r--src/testing/testing_api_cmd_post_instances.c10
3 files changed, 47 insertions, 5 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 9a69f121..b1932cd6 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2020 Taler Systems SA
+ 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
@@ -1251,6 +1251,41 @@ run (void *cls,
PAYTO_I1,
"USD",
MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_post_instances2 ("instance-create-ACL",
+ merchant_url,
+ "i-acl",
+ 0, NULL,
+ "controlled instance",
+ json_pack ("{s:s}", "city",
+ "shopcity"),
+ json_pack ("{s:s}", "city",
+ "lawyercity"),
+ "EUR:0.1",
+ 42,
+ "EUR:0.2",
+ GNUNET_TIME_UNIT_MINUTES,
+ GNUNET_TIME_UNIT_MINUTES,
+ RFC_8959_PREFIX "EXAMPLE",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-ACL",
+ merchant_url,
+ "i-acl",
+ 1,
+ payto_uris,
+ "controlled instance",
+ json_pack ("{s:s}",
+ "street",
+ "bobstreet"),
+ json_pack ("{s:s}",
+ "street",
+ "bobjuryst"),
+ "EUR:0.1",
+ 4,
+ "EUR:0.5",
+ GNUNET_TIME_UNIT_MINUTES,
+ GNUNET_TIME_UNIT_MINUTES,
+ RFC_8959_PREFIX "SANDBOX",
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2",
merchant_url,
"i2",
diff --git a/src/testing/testing_api_cmd_patch_instance.c b/src/testing/testing_api_cmd_patch_instance.c
index 2248c1ac..2cbd0e5b 100644
--- a/src/testing/testing_api_cmd_patch_instance.c
+++ b/src/testing/testing_api_cmd_patch_instance.c
@@ -142,12 +142,13 @@ patch_instance_cb (void *cls,
}
switch (hr->http_status)
{
- case MHD_HTTP_OK:
+ case MHD_HTTP_NO_CONTENT:
break;
// FIXME: add other legitimate states here...
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unhandled HTTP status.\n");
+ "Unhandled HTTP status %u.\n",
+ hr->http_status);
}
TALER_TESTING_interpreter_next (pis->is);
}
diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c
index acd623b6..7eb2e7fa 100644
--- a/src/testing/testing_api_cmd_post_instances.c
+++ b/src/testing/testing_api_cmd_post_instances.c
@@ -150,7 +150,8 @@ post_instances_cb (void *cls,
default:
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unhandled HTTP status.\n");
+ "Unhandled HTTP status %u.\n",
+ hr->http_status);
}
TALER_TESTING_interpreter_next (pis->is);
}
@@ -188,7 +189,12 @@ post_instances_run (void *cls,
pis->auth_token,
&post_instances_cb,
pis);
- GNUNET_assert (NULL != pis->iph);
+ if (NULL == pis->iph)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (pis->is);
+ return;
+ }
}