aboutsummaryrefslogtreecommitdiff
path: root/testdata/http_server
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-15 02:22:37 +0700
committerShulhan <ms@kilabit.info>2023-11-16 00:54:55 +0700
commit622bd72e6f2d3bd848963fc486fef1b39760e2ac (patch)
tree476d90b90a906f4222017b2842de8d763367d66f /testdata/http_server
parent79ac55824fc969ec3a773e46e450f6ba410bee1a (diff)
downloadawwan-622bd72e6f2d3bd848963fc486fef1b39760e2ac.tar.xz
all: implement HTTP API to decrypt file
Similar to the CLI, the HTTP API accept the path of vault file and return the path to decrypted file.
Diffstat (limited to 'testdata/http_server')
-rw-r--r--testdata/http_server/decrypt_test.data40
1 files changed, 40 insertions, 0 deletions
diff --git a/testdata/http_server/decrypt_test.data b/testdata/http_server/decrypt_test.data
new file mode 100644
index 0000000..fce0b18
--- /dev/null
+++ b/testdata/http_server/decrypt_test.data
@@ -0,0 +1,40 @@
+Testing HTTP API for Decrypt.
+
+>>> withValidRequest/body
+{"path_vault":"/plain.txt.vault"}
+
+<<< withValidRequest/Response/body
+{
+ "data": {
+ "path": "/plain.txt",
+ "path_vault": "/plain.txt.vault"
+ },
+ "code": 200
+}
+
+>>> withEmptyValue/body
+{"path_vault":""}
+
+<<< withEmptyValue/Response/body
+{
+ "message": "Decrypt: empty path_vault",
+ "code": 400
+}
+
+>>> withDirectory/body
+{"path_vault":"/.ssh"}
+
+<<< withDirectory/Response/body
+{
+ "message": "Decrypt: \"/.ssh\" is a directory",
+ "code": 400
+}
+
+>>> withFileNotExist/body
+{"path_vault":"/thisisnotexist"}
+
+<<< withFileNotExist/Response/body
+{
+ "message": "Decrypt \"/thisisnotexist\": file does not exist",
+ "code": 400
+}