Skip to content

Commit

Permalink
fix: status should be evaluate latest response if failed #383
Browse files Browse the repository at this point in the history
  • Loading branch information
lucagiove committed Nov 14, 2023
1 parent 1b1b617 commit 40faddf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
13 changes: 13 additions & 0 deletions atests/issues/334.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*** Settings ***
Library RequestsLibrary
Resource ../res_setup.robot

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
Status Should Be 404 ${response_error}
1 change: 0 additions & 1 deletion atests/test_status_assertions.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Resource res_setup.robot
Suite Setup Setup Flask Http Server
Suite Teardown Teardown Flask Http Server And Sessions


*** Test Cases ***

Request And Status Should Be Different
Expand Down
2 changes: 1 addition & 1 deletion src/RequestsLibrary/RequestsKeywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def status_should_be(self, expected_status, response=None, msg=None):
| ELSE
| [...]
"""
if not response:
if response is None:
response = self.last_response
self._check_status(expected_status, response, msg)

Expand Down
2 changes: 1 addition & 1 deletion src/RequestsLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '0.9.5'
VERSION = '0.9.6'

0 comments on commit 40faddf

Please sign in to comment.