浏览代码

task(tests): Create shell scripts to test several aspects of
application.

Douglas A 3 年之前
父节点
当前提交
2ad22b520c
共有 4 个文件被更改,包括 19 次插入0 次删除
  1. 4 0
      tests/cmd/auth/createuser.json
  2. 12 0
      tests/cmd/auth/createuser.sh
  3. 0 0
      tests/cmd/auth/logintest.json
  4. 3 0
      tests/cmd/auth/logintest.sh

+ 4 - 0
tests/cmd/auth/createuser.json

@@ -0,0 +1,4 @@
+{
+    "username": "mariamaria",
+    "passwordHash": "123456123456"
+}

+ 12 - 0
tests/cmd/auth/createuser.sh

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+resp1=$(cat createuser.json | curl -s -H "Content-Type: application/json" localhost:8080/signup --data @- | jq .created) 
+z=$(echo $resp1 | grep true)
+test -z $z && exit
+echo User Created: $resp1 | grep true
+
+
+resp2=$(cat createuser.json | curl -s -H "Content-Type: application/json" localhost:8080/login --data @- | jq .authenticated)
+z=$(echo $resp2 | grep true)
+test -z $z && exit
+echo Authenticated: $resp2 | grep true

+ 0 - 0
test.json → tests/cmd/auth/logintest.json


+ 3 - 0
tests/cmd/auth/logintest.sh

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cat logintest.json | curl -H "Content-Type: application/json" localhost:8080/login --data @-