-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from PaulBrandUWV/new_http_methods
Keywords for TRACE and CONNECT HTTP methods
- Loading branch information
Showing
38 changed files
with
1,528 additions
and
1,300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ venv/* | |
env/* | ||
|
||
.vscode/* | ||
|
||
# ignore http server log | ||
atests/http_server/http_server.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*** Settings *** | ||
Resource res_setup.robot | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
*** Settings *** | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
Resource ../res_setup.robot | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Variables *** | ||
${JSON_DATA} '{"file":{"path":"/logo1.png"},"token":"some-valid-oauth-token"}' | ||
${JSON_DATA} '{"file":{"path":"/logo1.png"},"token":"some-valid-oauth-token"}' | ||
|
||
|
||
*** Test Cases *** | ||
Delete Request With Data | ||
${headers}= Create Dictionary Content-Type=application/json | ||
${resp}= DELETE On Session ${GLOBAL_SESSION} /anything data=${JSON_DATA} headers=${headers} | ||
Should Be Equal As Strings ${resp.json()}[method] DELETE | ||
|
||
${headers}= Create Dictionary Content-Type=application/json | ||
${resp}= DELETE On Session ${GLOBAL_SESSION} /anything data=${JSON_DATA} headers=${headers} | ||
Should Be Equal As Strings ${resp.json()}[method] DELETE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
*** Settings *** | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
Resource ../res_setup.robot | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Variables *** | ||
${JSON_DATA} '{"file":{"path":"/logo1.png"},"token":"some-valid-oauth-token"}' | ||
${JSON_DATA} '{"file":{"path":"/logo1.png"},"token":"some-valid-oauth-token"}' | ||
|
||
|
||
*** Test Cases *** | ||
Encoding Error | ||
${headers}= Create Dictionary Content-Type=application/json | ||
Set Suite Variable ${data} { "elementToken":"token", "matchCriteria":[{"field":"name","dataType":"string","useOr":"false","fieldValue":"Operation check 07", "closeParen": "false", "openParen": "false", "operator": "equalTo"}], "account": { "annualRevenue": "456666", "name": "Account", "numberOfEmployees": "integer", "billingAddress": { "city": "Miami", "country": "US", "countyOrDistrict": "us or fl", "postalCode": "33131", "stateOrProvince": "florida", "street1": "Trade Center", "street2": "North Main rd" }, "number": "432", "industry": "Bank", "type": "string", "shippingAddress": { "city": "denver", "country": "us", "countyOrDistrict": "us or co", "postalCode": "80202", "stateOrProvince": "colorado", "street1": "Main street", "street2": "101 Avenu"}}} | ||
${headers}= Create Dictionary Content-Type=application/json | ||
Set Suite Variable | ||
... ${data} | ||
... { "elementToken":"token", "matchCriteria":[{"field":"name","dataType":"string","useOr":"false","fieldValue":"Operation check 07", "closeParen": "false", "openParen": "false", "operator": "equalTo"}], "account": { "annualRevenue": "456666", "name": "Account", "numberOfEmployees": "integer", "billingAddress": { "city": "Miami", "country": "US", "countyOrDistrict": "us or fl", "postalCode": "33131", "stateOrProvince": "florida", "street1": "Trade Center", "street2": "North Main rd" }, "number": "432", "industry": "Bank", "type": "string", "shippingAddress": { "city": "denver", "country": "us", "countyOrDistrict": "us or co", "postalCode": "80202", "stateOrProvince": "colorado", "street1": "Main street", "street2": "101 Avenu"}}} | ||
|
||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${data} headers=${headers} | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${data} headers=${headers} | ||
Should Be Equal As Strings ${resp.status_code} 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
Resource ../res_setup.robot | ||
Library RequestsLibrary | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
Post Content application/json With Empty Data Should Have No Body | ||
${content-type}= Create Dictionary content-type application/json | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${EMPTY} headers=${content-type} | ||
Should Be Empty ${resp.json()['data']} | ||
${content-type}= Create Dictionary content-type application/json | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${EMPTY} headers=${content-type} | ||
Should Be Empty ${resp.json()['data']} | ||
|
||
Post Content With Empty Data Should Have No Body | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${EMPTY} | ||
Should Be Empty ${resp.json()['data']} | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything data=${EMPTY} | ||
Should Be Empty ${resp.json()['data']} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
*** Settings *** | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
Resource ../res_setup.robot | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library OperatingSystem | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
Post Request With XML File | ||
[Tags] post | ||
${file_data}= Get File ${CURDIR}${/}test.xml | ||
${files}= Create Dictionary xml=${file_data} | ||
${headers}= Create Dictionary Authorization=testing-token | ||
Log ${headers} | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything files=${files} headers=${headers} | ||
[Tags] post | ||
${file_data}= Get File ${CURDIR}${/}test.xml | ||
${files}= Create Dictionary xml=${file_data} | ||
${headers}= Create Dictionary Authorization=testing-token | ||
Log ${headers} | ||
${resp}= POST On Session ${GLOBAL_SESSION} /anything files=${files} headers=${headers} | ||
|
||
Log ${resp.json()} | ||
Log ${resp.json()} | ||
|
||
Set Test Variable ${req_headers} ${resp.json()['headers']} | ||
Set Test Variable ${req_headers} ${resp.json()['headers']} | ||
|
||
Dictionary Should Contain Key ${req_headers} Authorization | ||
Dictionary Should Contain Key ${req_headers} Authorization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
Library RequestsLibrary | ||
|
||
|
||
*** Test Cases *** | ||
Test NTLM Session without installed library | ||
${auth}= Create List 1 2 3 | ||
Run Keyword And Expect Error requests_ntlm module not installed Create Ntlm Session ntlm http://localhost:80 ${auth} | ||
${auth}= Create List 1 2 3 | ||
Run Keyword And Expect Error | ||
... requests_ntlm module not installed | ||
... Create Ntlm Session | ||
... ntlm | ||
... http://localhost:80 | ||
... ${auth} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
Resource ../res_setup.robot | ||
Library RequestsLibrary | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
Test On Session Keyword With Verify As Parameter | ||
|
||
${resp}= GET On Session ${GLOBAL_SESSION} / verify=${False} | ||
Status Should Be OK ${resp} | ||
${resp}= GET On Session ${GLOBAL_SESSION} / verify=${False} | ||
Status Should Be OK ${resp} | ||
|
||
Test On Session Keyword With None Cookies As Parameter | ||
|
||
${resp}= GET On Session ${GLOBAL_SESSION} / cookies=${None} | ||
Status Should Be OK ${resp} | ||
${resp}= GET On Session ${GLOBAL_SESSION} / cookies=${None} | ||
Status Should Be OK ${resp} | ||
|
||
Test On Session Keyword With Cookies As Parameter | ||
|
||
${resp}= GET On Session ${GLOBAL_SESSION} / cookies=${False} | ||
Status Should Be OK ${resp} | ||
${resp}= GET On Session ${GLOBAL_SESSION} / cookies=${False} | ||
Status Should Be OK ${resp} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
*** Settings *** | ||
Library Collections | ||
Library RequestsLibrary | ||
Resource ../res_setup.robot | ||
Library Collections | ||
Library RequestsLibrary | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
Test GET with list of values as params | ||
${values_list}= Create List 1 2 3 4 5 | ||
${parameters}= Create Dictionary key ${values_list} | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=${parameters} | ||
Should Contain ${resp.json()}[url] ?key=1&key=2&key=3&key=4&key=5 | ||
Should Be Equal ${resp.json()}[args] ${parameters} | ||
${values_list}= Create List 1 2 3 4 5 | ||
${parameters}= Create Dictionary key ${values_list} | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=${parameters} | ||
Should Contain ${resp.json()}[url] ?key=1&key=2&key=3&key=4&key=5 | ||
Should Be Equal ${resp.json()}[args] ${parameters} | ||
|
||
Test GET with spaces in dictionary as params | ||
${parameters}= Create Dictionary key v a l u e | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=${parameters} | ||
Should Be Equal ${resp.json()}[args] ${parameters} | ||
${parameters}= Create Dictionary key v a l u e | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=${parameters} | ||
Should Be Equal ${resp.json()}[args] ${parameters} | ||
|
||
Test GET with spaces in string as params | ||
${parameters}= Create Dictionary | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=key=v a l u e | ||
Should Contain ${resp.json()}[url] v%20a%20l%20u%20e | ||
${parameters}= Create Dictionary | ||
${resp}= GET On Session ${GLOBAL_SESSION} url=/anything params=key=v a l u e | ||
Should Contain ${resp.json()}[url] v%20a%20l%20u%20e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
Resource ../res_setup.robot | ||
Library RequestsLibrary | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
|
||
Test evaluated response is always the one passed | ||
${response_error}= GET On Session ${GLOBAL_SESSION} url=/status/404 expected_status=any | ||
${response_ok}= GET On Session ${GLOBAL_SESSION} url=/status/200 expected_status=any | ||
${response_error}= GET On Session ${GLOBAL_SESSION} url=/status/404 expected_status=any | ||
${response_ok}= GET On Session ${GLOBAL_SESSION} url=/status/200 expected_status=any | ||
Status Should Be 404 ${response_error} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
*** Settings *** | ||
Library Collections | ||
Library String | ||
Library RequestsLibrary | ||
Library customAuthenticator.py | ||
Resource res_setup.robot | ||
Library RequestsLibrary | ||
Library customAuthenticator.py | ||
|
||
Suite Setup Setup Flask Http Server | ||
Suite Teardown Teardown Flask Http Server And Sessions | ||
|
||
*** Test Cases *** | ||
|
||
Get With Auth | ||
[Tags] get get-cert | ||
${auth}= Create List user passwd | ||
Create Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem | ||
${resp}= GET On Session httpbin /basic-auth/user/passwd | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
Should Be Equal As Strings ${resp.json()['authenticated']} True | ||
[Tags] get get-cert | ||
${auth}= Create List user passwd | ||
Create Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem | ||
${resp}= GET On Session httpbin /basic-auth/user/passwd | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
Should Be Equal As Strings ${resp.json()['authenticated']} True | ||
|
||
Get With Custom Auth | ||
[Tags] get | ||
${auth}= Get Custom Auth user passwd | ||
Create Custom Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem | ||
${resp}= GET On Session httpbin /basic-auth/user/passwd | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
Should Be Equal As Strings ${resp.json()['authenticated']} True | ||
[Tags] get | ||
${auth}= Get Custom Auth user passwd | ||
Create Custom Session httpbin https://httpbin.org auth=${auth} verify=${CURDIR}${/}cacert.pem | ||
${resp}= GET On Session httpbin /basic-auth/user/passwd | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
Should Be Equal As Strings ${resp.json()['authenticated']} True | ||
|
||
Get With Digest Auth | ||
[Tags] get get-cert | ||
[Tags] get get-cert | ||
${auth}= Create List user pass | ||
Create Digest Session httpbin https://httpbin.org auth=${auth} debug=3 verify=${CURDIR}${/}cacert.pem | ||
Create Digest Session | ||
... httpbin | ||
... https://httpbin.org | ||
... auth=${auth} | ||
... debug=3 | ||
... verify=${CURDIR}${/}cacert.pem | ||
${resp}= GET On Session httpbin /digest-auth/auth/user/pass | ||
Should Be Equal As Strings ${resp.status_code} 200 | ||
Should Be Equal As Strings ${resp.json()['authenticated']} True |
Oops, something went wrong.