summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-21 17:43:11 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-21 17:43:11 +0100
commit165c5337b1fc1df42521ab1cba520b7ddede6fdd (patch)
treec54051690eeef748157df657c6367e4bac5c5bf2 /src/testing
parent7f4626d3c5ec3d4cafe6a8992741c085537a3037 (diff)
downloadmerchant-165c5337b1fc1df42521ab1cba520b7ddede6fdd.tar.gz
merchant-165c5337b1fc1df42521ab1cba520b7ddede6fdd.tar.bz2
merchant-165c5337b1fc1df42521ab1cba520b7ddede6fdd.zip
add algorithm identifier to client API
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_cmd_get_template.c23
-rw-r--r--src/testing/testing_api_cmd_patch_template.c29
-rw-r--r--src/testing/testing_api_cmd_post_templates.c1
3 files changed, 25 insertions, 28 deletions
diff --git a/src/testing/testing_api_cmd_get_template.c b/src/testing/testing_api_cmd_get_template.c
index da8b6786..8b32156d 100644
--- a/src/testing/testing_api_cmd_get_template.c
+++ b/src/testing/testing_api_cmd_get_template.c
@@ -71,33 +71,27 @@ struct GetTemplateState
* Callback for a /get/templates/$ID operation.
*
* @param cls closure for this function
- * @param hr HTTP response details
- * @param template_description description of the template
- * @param pos_key shared key with the POS
- * @param template_contract where the contract of the company is
+ * @param tgr HTTP response details
*/
static void
get_template_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *template_description,
- const char *pos_key,
- const json_t *template_contract)
+ const struct TALER_MERCHANT_TemplateGetResponse *tgr)
{
struct GetTemplateState *gis = cls;
const struct TALER_TESTING_Command *template_cmd;
gis->igh = NULL;
- if (gis->http_status != hr->http_status)
+ if (gis->http_status != tgr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ tgr->hr.http_status,
+ (int) tgr->hr.ec,
TALER_TESTING_interpreter_get_current_label (gis->is));
TALER_TESTING_interpreter_fail (gis->is);
return;
}
- switch (hr->http_status)
+ switch (tgr->hr.http_status)
{
case MHD_HTTP_OK:
{
@@ -110,7 +104,7 @@ get_template_cb (void *cls,
TALER_TESTING_get_trait_template_description (template_cmd,
&expected_description))
TALER_TESTING_interpreter_fail (gis->is);
- if (0 != strcmp (template_description,
+ if (0 != strcmp (tgr->details.success.template_description,
*expected_description))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -121,6 +115,7 @@ get_template_cb (void *cls,
}
{
const char **expected_pos_key;
+ const char *pos_key = tgr->details.success.pos_key;
if (GNUNET_OK !=
TALER_TESTING_get_trait_template_pos_key (template_cmd,
@@ -147,7 +142,7 @@ get_template_cb (void *cls,
TALER_TESTING_get_trait_template_contract (template_cmd,
&expected_template_contract))
TALER_TESTING_interpreter_fail (gis->is);
- if (1 != json_equal (template_contract,
+ if (1 != json_equal (tgr->details.success.template_contract,
expected_template_contract))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/testing/testing_api_cmd_patch_template.c b/src/testing/testing_api_cmd_patch_template.c
index f6f5771b..81560fa7 100644
--- a/src/testing/testing_api_cmd_patch_template.c
+++ b/src/testing/testing_api_cmd_patch_template.c
@@ -85,7 +85,7 @@ struct PatchTemplateState
*/
static void
patch_template_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr)
+ const struct TALER_MERCHANT_HttpResponse *hr)
{
struct PatchTemplateState *pis = cls;
@@ -131,20 +131,21 @@ patch_template_cb (void *cls,
*/
static void
patch_template_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
struct PatchTemplateState *pis = cls;
pis->is = is;
pis->iph = TALER_MERCHANT_template_patch (is->ctx,
- pis->merchant_url,
- pis->template_id,
- pis->template_description,
- pis->pos_key,
- pis->template_contract,
- &patch_template_cb,
- pis);
+ pis->merchant_url,
+ pis->template_id,
+ pis->template_description,
+ pis->pos_key,
+ TALER_MCA_NONE,
+ pis->template_contract,
+ &patch_template_cb,
+ pis);
GNUNET_assert (NULL != pis->iph);
}
@@ -161,9 +162,9 @@ patch_template_run (void *cls,
*/
static enum GNUNET_GenericReturnValue
patch_template_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
+ const void **ret,
+ const char *trait,
+ unsigned int index)
{
struct PatchTemplateState *pts = cls;
struct TALER_TESTING_Trait traits[] = {
@@ -191,7 +192,7 @@ patch_template_traits (void *cls,
*/
static void
patch_template_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+ const struct TALER_TESTING_Command *cmd)
{
struct PatchTemplateState *pis = cls;
diff --git a/src/testing/testing_api_cmd_post_templates.c b/src/testing/testing_api_cmd_post_templates.c
index 434ddb96..39728792 100644
--- a/src/testing/testing_api_cmd_post_templates.c
+++ b/src/testing/testing_api_cmd_post_templates.c
@@ -141,6 +141,7 @@ post_templates_run (void *cls,
tis->template_id,
tis->template_description,
tis->pos_key,
+ TALER_MCA_NONE,
tis->template_contract,
&post_templates_cb,
tis);