[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.
- [taler-merchant] 27/277: implement GET /products/, (continued)
- [taler-merchant] 27/277: implement GET /products/, gnunet, 2020/07/05
- [taler-merchant] 34/277: add GET /instance CMD, gnunet, 2020/07/05
- [taler-merchant] 32/277: move libtalermerchanttesting and test cases to src/testing/, gnunet, 2020/07/05
- [taler-merchant] 35/277: add CMD for GET /instances, gnunet, 2020/07/05
- [taler-merchant] 33/277: move libtalermerchanttesting and test cases to src/testing/, gnunet, 2020/07/05
- [taler-merchant] 36/277: add DELETE /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 37/277: add cmd for POST /instances, gnunet, 2020/07/05
- [taler-merchant] 39/277: add PATCH /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 45/277: baseURL construction helper function', gnunet, 2020/07/05
- [taler-merchant] 44/277: fix ftbfs in lock logic, gnunet, 2020/07/05
- [taler-merchant] 41/277: add DELETE/PURGE /instances/ID command,
gnunet <=
- [taler-merchant] 42/277: implement purge, gnunet, 2020/07/05
- [taler-merchant] 43/277: toward stesting, gnunet, 2020/07/05
- [taler-merchant] 50/277: misc fixes, gnunet, 2020/07/05
- [taler-merchant] 49/277: fix fmt string, gnunet, 2020/07/05
- [taler-merchant] 68/277: sql-ing, gnunet, 2020/07/05
- [taler-merchant] 53/277: implemente DELETE /orders/ID, gnunet, 2020/07/05
- [taler-merchant] 38/277: add PATCH /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 46/277: improve API, gnunet, 2020/07/05
- [taler-merchant] 54/277: first hack at POST /orders, gnunet, 2020/07/05
- [taler-merchant] 57/277: implement logic to complete POSTed /orders using inventory data, gnunet, 2020/07/05