aboutsummaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-14 22:55:29 +0700
committerShulhan <ms@kilabit.info>2023-11-15 02:26:52 +0700
commitaced8dda50746fc349691f932ae32619688334d4 (patch)
treea945b757cb7984000f4877fb3fdc968daac2f91b /testdata
parent61ece8913599fa79c3fced73efb3973eab91d024 (diff)
downloadawwan-aced8dda50746fc349691f932ae32619688334d4.tar.xz
all: implement HTTP API to encrypt file
Similar to the CLI, the HTTP API accept the path of file and return the path to encrypted file.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/http_server/encrypt_test.data40
1 files changed, 40 insertions, 0 deletions
diff --git a/testdata/http_server/encrypt_test.data b/testdata/http_server/encrypt_test.data
new file mode 100644
index 0000000..eb95db5
--- /dev/null
+++ b/testdata/http_server/encrypt_test.data
@@ -0,0 +1,40 @@
+Testing HTTP API for Encrypt.
+
+>>> withValidRequest/body
+{"path":"/plain.txt"}
+
+<<< withValidRequest/Response/body
+{
+ "data": {
+ "path": "/plain.txt",
+ "path_vault": "/plain.txt.vault"
+ },
+ "code": 200
+}
+
+>>> withEmptyValue/body
+{"path":""}
+
+<<< withEmptyValue/Response/body
+{
+ "message": "Encrypt: empty path",
+ "code": 400
+}
+
+>>> withDirectory/body
+{"path":"/.ssh"}
+
+<<< withDirectory/Response/body
+{
+ "message": "Encrypt: \"/.ssh\" is a directory",
+ "code": 400
+}
+
+>>> withFileNotExist/body
+{"path":"/thisisnotexist"}
+
+<<< withFileNotExist/Response/body
+{
+ "message": "Encrypt \"/thisisnotexist\": file does not exist",
+ "code": 400
+}