summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2024-12-24 11:52:50 +0100
committerVincent Douillet <vincent@vdouillet.fr>2024-12-26 10:49:13 +0100
commit2e04b2c23c66a42372d0ecaea2b0f4b2c7b7c7e5 (patch)
tree9249bb0e9792a11bb27df78a4d93a0b3c0be0b33 /test.c
parent878cd6e8792d5ac03eea59fec9fe8e325440d50c (diff)
delete files
Diffstat (limited to 'test.c')
-rw-r--r--test.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test.c b/test.c
index fe1703a..802afc5 100644
--- a/test.c
+++ b/test.c
@@ -2,6 +2,7 @@
#include <string.h>
#include "browse.h"
+#include "delete.h"
#include "http.h"
#include "upload.h"
#include "url.h"
@@ -91,6 +92,42 @@ test_upload_post()
}
static char *
+test_delete_get()
+{
+ struct kreq r;
+ struct http_ret ret;
+
+ r = (struct kreq) {
+ .pname = "/vault",
+ .path = "a",
+ .suffix = "txt",
+ .method = KMETHOD_GET,
+ };
+ ret = del(&r);
+
+ mu_assert("error, GET delete failed!", ret.code <= KHTTP_400);
+ return 0;
+}
+
+static char *
+test_delete_post()
+{
+ struct kreq r;
+ struct http_ret ret;
+
+ r = (struct kreq) {
+ .pname = "/vault",
+ .path = "Folder",
+ .suffix = "",
+ .method = KMETHOD_POST,
+ };
+ ret = del(&r);
+
+ mu_assert("error, POST delete failed!", ret.code <= KHTTP_400);
+ return 0;
+}
+
+static char *
test_url_build()
{
char dst[BUF_SZ], *expected;
@@ -127,6 +164,8 @@ all_tests()
mu_run_test(test_browse_path_too_long);
mu_run_test(test_url_build);
mu_run_test(test_upload_post);
+ mu_run_test(test_delete_get);
+ mu_run_test(test_delete_post);
return 0;
}