-
Notifications
You must be signed in to change notification settings - Fork 282
Keywords for TRACE and CONNECT HTTP methods #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lucagiove
merged 15 commits into
MarketSquare:master
from
PaulBrandUWV:new_http_methods
May 28, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
29451ff
Adds support for TARCE and CONNECT http methods
PaulBrandUWV 9466c48
Adds acceptance tests for CONNECT and TRACE http methods
PaulBrandUWV 877d9e6
Updates documentation
PaulBrandUWV 34abf88
Fixes requestsonsession unit tests
PaulBrandUWV 58eadb7
Merge branch 'master' into new_http_methods
PaulBrandUWV 5852431
Adds acceptance tests for CONNECT and TRACE (on session) keywords
PaulBrandUWV ff1e9e3
Merge branch 'master' into new_http_methods
PaulBrandUWV ad4e427
Merge branch 'master' into new_http_methods
PaulBrandUWV 0f4b5f8
Fixes default value allow_redirection
PaulBrandUWV 5022084
Add acceptance tests for allow_redirection argment for session less k…
PaulBrandUWV 4f81724
Fixes typo in OPTIONS keywords documentation
PaulBrandUWV b854fce
Speeds up aceptance tests by starting local flask server once
PaulBrandUWV 30daa99
Formats python files with isort and black
PaulBrandUWV ee7dbb6
Redirect http server stdout and stderr to file to prevent freeze on w…
PaulBrandUWV d93c3a4
Merge branch 'master' into new_http_methods
PaulBrandUWV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.