Browse Source

add test : login

nas 3 years ago
parent
commit
727cfa9063
1 changed files with 30 additions and 0 deletions
  1. 30
    0
      test/list_users.sh

+ 30
- 0
test/list_users.sh View File

@@ -0,0 +1,30 @@
1
+#/bin/sh
2
+
3
+help() {
4
+    echo "Syntaxe"
5
+    echo "‾‾‾‾‾‾‾"
6
+    echo "sh $0 [ adresse ] [ username ] [ password ]\n"
7
+}
8
+
9
+if [ -z "$1" ]
10
+then
11
+    echo "Missing parameters : web adresses is needed\n"
12
+    help
13
+    exit
14
+fi
15
+if [ -z "$2" ]
16
+then
17
+    echo "Missing parameters : username is needed\n"
18
+    help
19
+    exit
20
+fi
21
+if [ -z "$3" ]
22
+then
23
+    echo "Missing parameters : password is needed\n"
24
+    help
25
+    exit
26
+fi
27
+echo "Login as $2 in cookie.txt"
28
+echo "$1 $2 $3"
29
+curl --header "Content-Type: application/json" --cookie-jar cookie.txt --request POST --data "{\"username\":\"$2\",\"password\":\"$3\"}" $1/api.php/login
30
+echo "\n"

Loading…
Cancel
Save