-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_env_setup
More file actions
executable file
·82 lines (75 loc) · 1.67 KB
/
test_env_setup
File metadata and controls
executable file
·82 lines (75 loc) · 1.67 KB
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
74
75
76
77
78
79
80
81
82
#!/bin/bash
# This should define a few helper methods for easy testing
# The URLS
ppt_local_url="http://localhost:8080"
ppt_remote_url="http://ppt-http.appspot.com"
# The current global url
ppt_url=$ppt_local_url
# Creates a new PPT
function ppt_newppt {
local name=${1-"default"}
local slides=${2-"10"}
curl -v $ppt_url/service/register --data name=$name --data slides=$slides
echo
}
# Gets a PPT
function ppt_getppt {
local pptid=${1:?"pptid is required"}
if [[ -z $pptid ]]
then
echo "No PPT ID Specified"
else
curl -v $ppt_url/service/register/$pptid
echo
fi
}
# Deletes a PPT
function ppt_deleteppt {
local pptid=${1:?"pptid is required"}
if [[ -z $pptid ]]
then
echo "No PPT ID Specified"
else
curl -X DELETE -v $ppt_url/service/register/$1
echo
fi
}
# Push an action for this ppt
function ppt_pushaction {
local pptid=${1:?"pptid is required"}
local action=${2:?"action is required"}
if [[ -z $pptid ]]
then
echo "No PPT ID Specified"
elif [[ -z $action ]]
then
echo "No Action Specified"
else
curl -v $ppt_url/service/present/$1 --data action=$2
echo
fi
}
# Push a goto action for this ppt
function ppt_pushgoto {
local pptid=${1:?"pptid is required"}
local slide=${2:?"slide is required"}
if [[ -z $pptid ]]
then
echo "No PPT ID Specified"
elif [[ -z $slide ]]
then
echo "No Slide Specified"
else
curl -v $ppt_url/service/present/$1 --data action=goto --data slide=$2
echo
fi
}
export ppt_url
export ppt_local_url
export ppt_remote_url
export -f ppt_newppt
export -f ppt_deleteppt
export -f ppt_getppt
export -f ppt_pushaction
export -f ppt_pushgoto
export -f ppt_popall