Skip to content

Commit 3ff7444

Browse files
authored
Issue #110 - Add RequestsLibrary in Docker Image
* Fixed failing tests
1 parent 9de51c1 commit 3ff7444

File tree

1 file changed

+4
-141
lines changed

1 file changed

+4
-141
lines changed

test/requests.robot

Lines changed: 4 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ Library Collections
33
Library String
44
Library RequestsLibrary
55
Library OperatingSystem
6-
Library customAuthenticator.py
76

87
Suite Teardown Delete All Sessions
98

109
*** Test Cases ***
1110
Get Requests
1211
[Tags] get
1312
Create Session google http://www.google.com
14-
Create Session github https://api.github.com verify=${CURDIR}${/}cacert.pem
13+
Create Session github https://api.github.com
1514
${resp}= Get Request google /
1615
Should Be Equal As Strings ${resp.status_code} 200
17-
${resp}= Get Request github /users/bulkan
16+
${resp}= Get Request github /repos/ppodgorsek/docker-robot-framework
1817
Should Be Equal As Strings ${resp.status_code} 200
19-
Dictionary Should Contain Value ${resp.json()} Bulkan Evcimen
18+
Dictionary Should Contain Value ${resp.json()} Robot Framework in Docker
2019

2120
Get Requests with Url Parameters
2221
[Tags] get
@@ -27,83 +26,19 @@ Get Requests with Url Parameters
2726
${jsondata}= To Json ${resp.content}
2827
Should Be Equal ${jsondata['args']} ${params}
2928

30-
Get Requests with Json Data
31-
[Tags] get
32-
Create Session httpbin http://httpbin.org
33-
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
34-
${resp}= Get Request httpbin /get json=${data}
35-
Should Be Equal As Strings ${resp.status_code} 200
36-
${jsondata}= To Json ${resp.content}
37-
# httpbin does not support this... Should Be Equal ${jsondata['json]} ${data}
38-
3929
Get HTTPS & Verify Cert
4030
[Tags] get get-cert
4131
Create Session httpbin https://httpbin.org verify=True
4232
${resp}= Get Request httpbin /get
4333
Should Be Equal As Strings ${resp.status_code} 200
4434

45-
Get HTTPS & Verify Cert with a CA bundle
46-
[Tags] get get-cert
47-
Create Session httpbin https://httpbin.org verify=${CURDIR}${/}cacert.pem
48-
${resp}= Get Request httpbin /get
49-
Should Be Equal As Strings ${resp.status_code} 200
50-
51-
Get HTTPS with Client Side Certificates
52-
[Tags] get get-cert
53-
@{client_certs}= Create List ${CURDIR}${/}clientcert.pem ${CURDIR}${/}clientkey.pem
54-
Create Client Cert Session crtsession https://server.cryptomix.com/secure client_certs=@{client_certs}
55-
${resp}= Get Request crtsession /
56-
Should Be Equal As Strings ${resp.status_code} 200
57-
58-
Get With Auth
59-
[Tags] get get-cert
60-
${auth}= Create List user passwd
61-
Create Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem
62-
${resp}= Get Request httpbin /basic-auth/user/passwd
63-
Should Be Equal As Strings ${resp.status_code} 200
64-
Should Be Equal As Strings ${resp.json()['authenticated']} True
65-
66-
Get With Custom Auth
67-
[Tags] get
68-
${auth}= Get Custom Auth user passwd
69-
Create Custom Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem
70-
${resp}= Get Request httpbin /basic-auth/user/passwd
71-
Should Be Equal As Strings ${resp.status_code} 200
72-
Should Be Equal As Strings ${resp.json()['authenticated']} True
73-
74-
Get With Digest Auth
75-
[Tags] get get-cert
76-
${auth}= Create List user pass
77-
Create Digest Session httpbin https://httpbin.org auth=${auth} debug=3 verify=${CURDIR}${/}cacert.pem
78-
${resp}= Get Request httpbin /digest-auth/auth/user/pass
79-
Should Be Equal As Strings ${resp.status_code} 200
80-
Should Be Equal As Strings ${resp.json()['authenticated']} True
81-
8235
Post Request With URL Params
8336
[Tags] post
8437
Create Session httpbin http://httpbin.org
8538
&{params}= Create Dictionary key=value key2=value2
8639
${resp}= Post Request httpbin /post params=${params}
8740
Should Be Equal As Strings ${resp.status_code} 200
8841

89-
Post Requests with Json Data
90-
[Tags] post
91-
Create Session httpbin http://httpbin.org
92-
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
93-
${resp}= Post Request httpbin /post json=${data}
94-
Should Be Equal As Strings ${resp.status_code} 200
95-
${jsondata}= To Json ${resp.content}
96-
Should Be Equal ${jsondata['json']} ${data}
97-
98-
Put Requests with Json Data
99-
[Tags] put
100-
Create Session httpbin http://httpbin.org
101-
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
102-
${resp}= Put Request httpbin /put json=${data}
103-
Should Be Equal As Strings ${resp.status_code} 200
104-
${jsondata}= To Json ${resp.content}
105-
Should Be Equal ${jsondata['json']} ${data}
106-
10742
Post Request With No Data
10843
[Tags] post
10944
Create Session httpbin http://httpbin.org
@@ -164,56 +99,6 @@ Post Request With Unicode Data
16499
${resp}= Post Request httpbin /post data=${data} headers=${headers}
165100
Dictionary Should Contain Value ${resp.json()['form']} 度假村
166101

167-
Post Request With Binary Data in Dictionary
168-
[Tags] post
169-
Create Session httpbin http://httpbin.org debug=3
170-
${file_data}= Get Binary File ${CURDIR}${/}data.json
171-
&{data}= Create Dictionary name=${file_data.strip()}
172-
&{headers}= Create Dictionary Content-Type=application/x-www-form-urlencoded
173-
${resp}= Post Request httpbin /post data=${data} headers=${headers}
174-
Log ${resp.json()['form']}
175-
Should Contain ${resp.json()['form']['name']} \u5ea6\u5047\u6751
176-
177-
Post Request With Binary Data
178-
[Tags] post
179-
Create Session httpbin http://httpbin.org debug=3
180-
${data}= Get Binary File ${CURDIR}${/}data.json
181-
&{headers}= Create Dictionary Content-Type=application/x-www-form-urlencoded
182-
${resp}= Post Request httpbin /post data=${data} headers=${headers}
183-
Log ${resp.json()['form']}
184-
${value}= evaluate list(${resp.json()}['form'].keys())[0]
185-
Should Contain ${value} 度假村
186-
187-
Post Request With Arbitrary Binary Data
188-
[Tags] post
189-
Create Session httpbin http://httpbin.org debug=3
190-
${data}= Get Binary File ${CURDIR}${/}randombytes.bin
191-
&{headers}= Create Dictionary Content-Type=application/octet-stream Accept=application/octet-stream
192-
${resp}= Post Request httpbin /post data=${data} headers=&{headers}
193-
# TODO Compare binaries. Content is json with base64 encoded data
194-
Log "Success"
195-
196-
Post With File
197-
[Tags] post
198-
Create Session httpbin http://httpbin.org
199-
${file_data}= Get Binary File ${CURDIR}${/}data.json
200-
&{files}= Create Dictionary file=${file_data}
201-
${resp}= Post Request httpbin /post files=${files}
202-
${file}= To Json ${resp.json()['files']['file']}
203-
Dictionary Should Contain Key ${file} one
204-
Dictionary Should Contain Key ${file} two
205-
206-
207-
Post Request With File
208-
[Tags] post
209-
Create Session httpbin http://httpbin.org
210-
${file_data}= Get Binary File ${CURDIR}${/}data.json
211-
&{files}= Create Dictionary file=${file_data}
212-
${resp}= Post Request httpbin /post files=${files}
213-
${file}= To Json ${resp.json()['files']['file']}
214-
Dictionary Should Contain Key ${file} one
215-
Dictionary Should Contain Key ${file} two
216-
217102
Post Request With Data and File
218103
[Tags] post
219104
Create Session httpbin http://httpbin.org
@@ -223,7 +108,7 @@ Post Request With Data and File
223108
&{files}= Create Dictionary file=${file_data}
224109
${resp}= Post Request httpbin /post files=${files} data=${data}
225110
Should Be Equal As Strings ${resp.status_code} 200
226-
111+
227112
Put Requests
228113
[Tags] put
229114
Create Session httpbin http://httpbin.org
@@ -246,22 +131,19 @@ Options Request
246131
Should Be Equal As Strings ${resp.status_code} 200
247132
Dictionary Should Contain Key ${resp.headers} allow
248133

249-
250134
Delete Request With URL Params
251135
[Tags] delete
252136
Create Session httpbin http://httpbin.org
253137
&{params}= Create Dictionary key=value key2=value2
254138
${resp}= Delete Request httpbin /delete ${params}
255139
Should Be Equal As Strings ${resp.status_code} 200
256140

257-
258141
Delete Request With No Data
259142
[Tags] delete
260143
Create Session httpbin http://httpbin.org
261144
${resp}= Delete Request httpbin /delete
262145
Should Be Equal As Strings ${resp.status_code} 200
263146

264-
265147
Delete Request With Data
266148
[Tags] delete
267149
Create Session httpbin http://httpbin.org debug=3
@@ -272,15 +154,6 @@ Delete Request With Data
272154
Comment Dictionary Should Contain Value ${resp.json()['data']} bulkan
273155
Comment Dictionary Should Contain Value ${resp.json()['data']} evcimen
274156

275-
Delete Requests with Json Data
276-
[Tags] delete
277-
Create Session httpbin http://httpbin.org
278-
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
279-
${resp}= Delete Request httpbin /delete json=${data}
280-
Should Be Equal As Strings ${resp.status_code} 200
281-
${jsondata}= To Json ${resp.content}
282-
Should Be Equal ${jsondata['json']} ${data}
283-
284157
Patch Requests
285158
[Tags] patch
286159
Create Session httpbin http://httpbin.org
@@ -290,21 +163,11 @@ Patch Requests
290163
Dictionary Should Contain Value ${resp.json()['form']} bulkan
291164
Dictionary Should Contain Value ${resp.json()['form']} evcimen
292165

293-
Patch Requests with Json Data
294-
[Tags] patch
295-
Create Session httpbin http://httpbin.org
296-
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
297-
${resp}= Patch Request httpbin /patch json=${data}
298-
Should Be Equal As Strings ${resp.status_code} 200
299-
${jsondata}= To Json ${resp.content}
300-
Should Be Equal ${jsondata['json']} ${data}
301-
302166
Get Request With Redirection
303167
[Tags] get
304168
Create Session httpbin http://httpbin.org debug=3
305169
${resp}= Get Request httpbin /redirect/1
306170
Should Be Equal As Strings ${resp.status_code} 200
307-
308171
${resp}= Get Request httpbin /redirect/1 allow_redirects=${true}
309172
Should Be Equal As Strings ${resp.status_code} 200
310173

0 commit comments

Comments
 (0)