diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-22 22:51:08 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-22 22:51:08 +0200 |
commit | b378eea34812a9b561be6149e40c4518070f34f7 (patch) | |
tree | eef92aaaf9082c23c8874ec2cab8f0eabc931ace | |
parent | 8dbb0c68bc6b6518afe75bd74e6dd69a4a24ea43 (diff) | |
download | merchant-b378eea34812a9b561be6149e40c4518070f34f7.tar.gz merchant-b378eea34812a9b561be6149e40c4518070f34f7.tar.bz2 merchant-b378eea34812a9b561be6149e40c4518070f34f7.zip |
add DELETE/PURGE /instances/ID command
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 34 | ||||
-rw-r--r-- | 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 abdc4006..2b2a9e8e 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 0101a4a1..d06b331b 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 */ |