-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·73 lines (49 loc) · 3.72 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# search get request
curl 127.0.0.1:8080/search
printf "\n\nadd post request of contact with only email and phone (both valid)\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"jraymond@wesleyan.edu\",\"phone\":\"1112223333\",\"attributes\":[]}" 127.0.0.1:8080/add
printf "\nadd post request of contact with additional attribute\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"hcurry@penstate.edu\",\"phone\":\"2223334444\",\"attributes\":[[\"name\",\"haskell curry\"]]}" 127.0.0.1:8080/add
printf "\nadd post request of contact with additional attributes\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"bobama@wesleyan.edu\",\"phone\":\"5556667777\",\"attributes\":[[\"name\",\"barack obama\"],[\"birthday\",\"May 6th 1965\"],[\"occupation\",\"president\"]]}" 127.0.0.1:8080/add
printf "\nadd post request with invalid email\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"bademail.@example.com\",\"phone\":\"1112223333\",\"attributes\":[[\"name\",\"invalid email\"]]}" 127.0.0.1:8080/add
printf "\nadd post request with invalid phone\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"okemail@example.com\",\"phone\":\"111111\",\"attributes\":[[\"name\",\"invalid phone \"]]}" 127.0.0.1:8080/add
printf "\nadd post request with invalid email and invalid phone\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"bademail.@example.com\",\"phone\":\"1111\",\"attributes\":[[\"name\",\"invalid both\"]]}" 127.0.0.1:8080/add
printf "\nsearch all\n"
curl 127.0.0.1:8080/search
printf "\nadding more contacts\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"temp0@temp.temp\",\"phone\":\"0776665555\",\"attributes\":[[\"name\",\"temp0\"]]}" 127.0.0.1:8080/add
printf "\n\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"temp1@temp.temp\",\"phone\":\"1776665555\",\"attributes\":[[\"name\",\"temp1\"]]}" 127.0.0.1:8080/add
printf "\n\n"
curl -H "Content-Type: application/json" -d "{\"email\":\"temp2@temp.temp\",\"phone\":\"2776665555\",\"attributes\":[[\"name\",\"temp2\"]]}" 127.0.0.1:8080/add
printf "\nsearch?for=temp0\n"
curl 127.0.0.1:8080/search?for=temp0
printf "\nsingle delete post request example\n"
curl -H "Content-Type: application/json" -d "[4]" 127.0.0.1:8080/delete
printf "\nmultiple delete post request example\n"
curl -H "Content-Type: application/json" -d "[5,6]" 127.0.0.1:8080/delete
printf "\nsearch?for=temp0\n"
curl 127.0.0.1:8080/search?for=temp0
printf "\nupdate contact with new attribute\n"
curl -H "Content-Type: application/json" -d "[1,[[\"updated\",\"true\"]]]" 127.0.0.1:8080/update
printf "\nupdate contact that does not exist with new attribute (something will go wrong)\n"
curl -H "Content-Type: application/json" -d "[999,[[\"exist\",\"shouldnotexist\"]]]" 127.0.0.1:8080/update
curl 127.0.0.1:8080/search?for=shouldnotexist
printf "\nupdate contact email\n"
curl -H "Content-Type: application/json" -d "[1,[[\"email\",\"update@email.com\"]]]" 127.0.0.1:8080/update
printf "\nupdate contact phone \n"
curl -H "Content-Type: application/json" -d "[1,[[\"phone\",\"3332221111\"]]]" 127.0.0.1:8080/update
printf "\nupdate contact invalid phone\n"
curl -H "Content-Type: application/json" -d "[1,[[\"phone\",\"0\"]]]" 127.0.0.1:8080/update
printf "\nupdate contact invalid email\n"
curl -H "Content-Type: application/json" -d "[1,[[\"email\",\"wat\"]]]" 127.0.0.1:8080/update
printf "\nupdate contact multiple attributes\n"
curl -H "Content-Type: application/json" -d "[1,[[\"updated\",\"truetrue\"],[\"birthday\",\"the ides of march\"]]]" 127.0.0.1:8080/update
curl -H "Content-Type: application/json" -d "[2,[[\"updated\",\"truetrue\"],[\"birthday\",\"also the ides of march\"]]]" 127.0.0.1:8080/update
printf "\nsearch\n"
curl 127.0.0.1:8080/search
printf "\n"