summaryrefslogtreecommitdiff
path: root/apifw.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-03-24 15:31:13 +0200
committerLars Wirzenius <liw@liw.fi>2018-03-24 18:13:54 +0200
commitcdcf71634ffc16a3cd09a2ee2641ddbaaba165ec (patch)
tree9b3a5d392382144d7a8b9c418f5484fe0b22b9fc /apifw.yarn
parentde78d0097e0feb858391010d3e8be784104ad28e (diff)
downloadapifw-cdcf71634ffc16a3cd09a2ee2641ddbaaba165ec.tar.gz
Add: tests for downloading
We're going to mess with uploading and download of data. Best have tests for them before we start.
Diffstat (limited to 'apifw.yarn')
-rw-r--r--apifw.yarn13
1 files changed, 12 insertions, 1 deletions
diff --git a/apifw.yarn b/apifw.yarn
index a914ab9..064784b 100644
--- a/apifw.yarn
+++ b/apifw.yarn
@@ -38,7 +38,12 @@ It's a silly name. Please suggest something better.
WHEN client gets an authorization token with scope "uapi_upload_put"
AND client uploads a fake jpg
THEN HTTP status code is 200 OK
- AND HTTP body is "thank you for fake jpg"
+ AND HTTP body is "thank you for your data"
+
+ WHEN client gets an authorization token with scope "uapi_download_get"
+ AND client requests GET /download using token
+ THEN HTTP status code is 200 OK
+ AND HTTP body is "fake jpg"
FINALLY stop apitest
@@ -87,6 +92,12 @@ It's a silly name. Please suggest something better.
curl -sv -H "Authorization: Bearer $token" \
"http://127.0.0.1:$port/version" > "$DATADIR/out" 2> "$DATADIR/err"
+ IMPLEMENTS WHEN client requests GET /download using token
+ token="$(cat "$DATADIR/token")"
+ port="$(cat "$DATADIR/port")"
+ curl -sv -H "Authorization: Bearer $token" \
+ "http://127.0.0.1:$port/download" > "$DATADIR/out" 2> "$DATADIR/err"
+
IMPLEMENTS WHEN client uploads a fake jpg
token="$(cat "$DATADIR/token")"
port="$(cat "$DATADIR/port")"