-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·66 lines (55 loc) · 2.01 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
#!/usr/bin/env bash
## A testing script, using curl
# set current userid to '0'
succes=`curl -s -X PUT http://127.0.0.1:5000/user/0`
# post a new document with title "Testing Document"
title="Testing Document"
docid=`curl -s -F name="$title" http://127.0.0.1:5000/document/`
echo "Posted Document"
echo "Title: "$title
echo "ID: "$docid
echo ""
# post some new revisions
text="I think we should think about our children, but not our children's children. Because the idea of children having sex is gross"
topics="education morality jackhandy"
rid1=`curl -s -F text="$text" -F topics="$topics" http://127.0.0.1:5000/document/${docid}/`
echo "Posted Revision"
echo "Text: "$text
echo "Topics: "$topics
echo "ID: "$rid1
echo ""
text="I think we need ponies in every park, rivers of lemonade, and peace between all men."
topics="animals public_spaces international_affairs"
rid2=`curl -s -F text="$text" -F topics="$topics" http://127.0.0.1:5000/document/${docid}/`
echo "Posted Revision"
echo "Text: "$text
echo "Topics: "$topics
echo "ID: "$rid2
echo ""
text="Better food at schools, higher pay for teachers, and safer neighbourhoods."
topics="education public_safety"
rid3=`curl -s -F text="$text" -F topics="$topics" http://127.0.0.1:5000/document/${docid}/`
echo "Posted Revision"
echo "Text: "$text
echo "Topics: "$topics
echo "ID: "$rid3
echo ""
# post some forks
text="I think we need horses in every park, rivers of lemonade, and peace between all men."
topics="animals public_spaces international_affairs"
fid1=`curl -s -F text="$text" -F topics="$topics" http://127.0.0.1:5000/revision/${rid2}/`
echo "Forked Revision $rid2"
echo "Text: "$text
echo "Topics: "$topics
echo "ID: "$fid1
echo ""
# vote for revision 1
curl -s -X PUT http://127.0.0.1:5000/vote/0/${fid1}/0/
curl -s -X PUT http://127.0.0.1:5000/vote/0/${rid2}/1/
# this should not work, and does not work
#curl -s -X PUT http://127.0.0.1:5000/vote/0/${rid3}/2/
# query resulting doc
echo "Getting document: $docid"
echo "--"
curl http://127.0.0.1:5000/document/${docid}/
echo "--"