12
12
info(sprintf('Testing routes - without authentication'))->
13
get('/webservices/')->
14
14
with('request')->begin()->
15
15
isParameter('module', 'agWebservices')->
16
16
isParameter('action', 'index')->
66
66
info(sprintf('Staff in XML - valid token'))->
67
get('/webservices/get/agasti/staff.xml')->
67
get('/webservices/staff.xml/agasti')->
68
68
with('request')->begin()->
69
69
isParameter('module', 'agWebservices')->
70
70
isParameter('action', 'get')->
83
83
info(sprintf('Organizations in XML - valid token'))->
84
get('/webservices/get/agasti/organizations.xml')->
84
get('/webservices/organizations.xml/agasti')->
85
85
with('request')->begin()->
86
86
isParameter('module', 'agWebservices')->
87
87
isParameter('action', 'get')->
100
100
info(sprintf('Staff in JSON - valid token'))->
101
get('/webservices/get/agasti/staff.json')->
101
get('/webservices/staff.json/agasti')->
102
102
with('request')->begin()->
103
103
isParameter('module', 'agWebservices')->
104
104
isParameter('action', 'get')->
112
112
isHeader('Content-type', 'application/json')->
113
113
matches('/"type"\:"staff"/')->
114
114
matches('/"id"\:"\d+"/')->
115
matches('/"person_id"\:"\d+"/')->
117
118
info(sprintf('Organizations in JSON - valid token'))->
118
get('/webservices/get/agasti/organizations.json')->
119
get('/webservices/organizations.json/agasti')->
119
120
with('request')->begin()->
120
121
isParameter('module', 'agWebservices')->
121
122
isParameter('action', 'get')->
135
136
info(sprintf('Try to reach datapoint with invalid token'))->
136
get('/webservices/get/invalid_token/organizations.json')->
137
get('/webservices/organizations.json/invalid_token')->
137
138
with('request')->begin()->
138
139
isParameter('module', 'agWebservices')->
139
140
isParameter('action', 'get')->
149
150
info(sprintf('Try to reach datapoint with inactive client'))->
150
get('/webservices/get/inactive_client/organizations.json')->
151
get('/webservices/organizations.json/inactive_client')->
151
152
with('request')->begin()->
152
153
isParameter('module', 'agWebservices')->
153
154
isParameter('action', 'get')->
159
160
with('response')->begin()->
160
161
isStatusCode(404)->
164
info(sprintf('Filter data through query params'))->
165
get('/webservices/staff.json/agasti/is_available=1&limit=10&person=1&order=staff')->
166
with('request')->begin()->
167
isParameter('module', 'agWebservices')->
168
isParameter('action', 'get')->
169
isParameter('token', 'agasti')->
170
isParameter('datapoint', 'staff')->
171
isParameter('sf_format', 'json')->
172
isParameter('url_param', 'is_available=1&limit=10&person=1&order=staff')->
175
with('response')->begin()->
177
matches('/"type"\:"staff"/')->
178
matches('/"id"\:"\d+"/')->
179
matches('/"person_id"\:"1"/')->
180
matches('/"is_available"\:true/')->
183
info(sprintf('Filter data through query params - no results'))->
184
get('/webservices/staff.xml/agasti/limit=0&is_available=0&person=1&order=staff')->
185
with('request')->begin()->
186
isParameter('module', 'agWebservices')->
187
isParameter('action', 'get')->
188
isParameter('token', 'agasti')->
189
isParameter('datapoint', 'staff')->
190
isParameter('sf_format', 'xml')->
191
isParameter('url_param', 'limit=0&is_available=0&person=1&order=staff')->
194
with('response')->begin()->
197
isHeader('Content-type', 'text/xml; charset=utf-8')->
198
checkElement('results', true)->
b'\\ No newline at end of file'