gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 41/277: add DELETE/PURGE /instances/ID command


From: gnunet
Subject: [taler-merchant] 41/277: add DELETE/PURGE /instances/ID command
Date: Sun, 05 Jul 2020 20:49:14 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

commit b378eea34812a9b561be6149e40c4518070f34f7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 22 22:51:08 2020 +0200

    add DELETE/PURGE /instances/ID command
---
 src/include/taler_merchant_testing_lib.h      | 34 ++++++++++++++++
 src/testing/testing_api_cmd_delete_instance.c | 58 ++++++++++++++++++++++++---
 2 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index abdc400..2b2a9e8 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -213,6 +213,40 @@ TALER_TESTING_cmd_merchant_get_instance (const char *label,
                                          const char *instance_reference);
 
 
+/**
+ * Define a "PURGE instance" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ *        PURGE /instances/$ID request.
+ * @param instance_id the ID of the instance to query
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_purge_instance (const char *label,
+                                           const char *merchant_url,
+                                           const char *instance_id,
+                                           unsigned int http_status);
+
+
+/**
+ * Define a "DELETE instance" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ *        DELETE /instances/$ID request.
+ * @param instance_id the ID of the instance to query
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_delete_instance (const char *label,
+                                            const char *merchant_url,
+                                            const char *instance_id,
+                                            unsigned int http_status);
+
+
 /* ******************** OLD ******************* */
 
 /**
diff --git a/src/testing/testing_api_cmd_delete_instance.c 
b/src/testing/testing_api_cmd_delete_instance.c
index 0101a4a..d06b331 100644
--- a/src/testing/testing_api_cmd_delete_instance.c
+++ b/src/testing/testing_api_cmd_delete_instance.c
@@ -59,6 +59,11 @@ struct DeleteInstanceState
    */
   unsigned int http_status;
 
+  /**
+   * Use purge, not delete.
+   */
+  bool purge;
+
 };
 
 
@@ -112,11 +117,18 @@ delete_instance_run (void *cls,
   struct DeleteInstanceState *dis = cls;
 
   dis->is = is;
-  dis->igh = TALER_MERCHANT_instance_delete (is->ctx,
-                                             dis->merchant_url,
-                                             dis->instance_id,
-                                             &delete_instance_cb,
-                                             dis);
+  if (dis->purge)
+    dis->igh = TALER_MERCHANT_instance_purge (is->ctx,
+                                              dis->merchant_url,
+                                              dis->instance_id,
+                                              &delete_instance_cb,
+                                              dis);
+  else
+    dis->igh = TALER_MERCHANT_instance_delete (is->ctx,
+                                               dis->merchant_url,
+                                               dis->instance_id,
+                                               &delete_instance_cb,
+                                               dis);
   GNUNET_assert (NULL != dis->igh);
 }
 
@@ -179,4 +191,40 @@ TALER_TESTING_cmd_merchant_delete_instance (const char 
*label,
 }
 
 
+/**
+ * Define a "PURGE instance" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ *        PURGE /instances/$ID request.
+ * @param instance_id the ID of the instance to query
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_purge_instance (const char *label,
+                                           const char *merchant_url,
+                                           const char *instance_id,
+                                           unsigned int http_status)
+{
+  struct DeleteInstanceState *dis;
+
+  dis = GNUNET_new (struct DeleteInstanceState);
+  dis->merchant_url = merchant_url;
+  dis->instance_id = instance_id;
+  dis->http_status = http_status;
+  dis->purge = true;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = dis,
+      .label = label,
+      .run = &delete_instance_run,
+      .cleanup = &delete_instance_cleanup
+    };
+
+    return cmd;
+  }
+}
+
+
 /* end of testing_api_cmd_delete_instance.c */

-- 
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]