-
Notifications
You must be signed in to change notification settings - Fork 0
/
REST_WSB.robot
48 lines (44 loc) · 2.18 KB
/
REST_WSB.robot
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
*** Settings ***
Resource wsb resource.tsv
Library RequestsLibrary
*** Test Cases ***
REST call 1
${stdout} Wsb Resource.Log to console test
Should Contain ${stdout} test
Should Match Regexp ${stdout} test WSB\\d{3}
Rest call 200
${url} Set Variable http://maps.googleapis.com
${resource} Set Variable /maps/api/geocode/xml
${address} Set Variable Gdynia.Poland
RequestsLibrary.Create Session GoogleRest ${url}
${params} Create Dictionary address1=${address} sensor=false
${response} RequestsLibrary.Get Request GoogleRest ${resource} params=${params}
${code} Set Variable ${response.status_code}
#&{response}{status_code}
log ${code}
Should Be Equal As Integers 200 ${code}
Rest call 400
${url} Set Variable http://maps.googleapis.com
${resource} Set Variable /maps/api/geocode/xml
${address} Set Variable Gdynia.Poland
RequestsLibrary.Create Session GoogleRest ${url}
${params} Create Dictionary address1=${address} sensor=false
${response} RequestsLibrary.Get Request GoogleRest ${resource} params=${params}
${code} Set Variable ${response.status_code}
#&{response}{status_code}
log ${code}
Run Keyword And Continue On Failure Should Not Be Equal As Integers 200 ${code}
Run Keyword And Continue On Failure Should Be Equal As Integers 400 ${code}
Rest call 200 google
${url} Set Variable http://maps.googleapis.com
${resource} Set Variable /maps/api/geocode/json
${address} Set Variable Gdynia.Poland
RequestsLibrary.Create Session GoogleRest ${url}
${params} Create Dictionary address=${address} sensor=false
${response} RequestsLibrary.Get Request GoogleRest ${resource} params=${params}
${code} Set Variable ${response.status_code}
#&{response}{status_code}
Run Keyword And Continue On Failure Should Be Equal As Integers 200 ${code}
${content} To Json ${response.content}
${status} Set Variable &{content}[status]
log ${content}