Skip to content

Commit

Permalink
Merge pull request #384 from MarketSquare/383-status-should-be-uses-l…
Browse files Browse the repository at this point in the history
…ast-request-even-if-a-response-is-provided

#383 status should be uses last request even if a response is provided
  • Loading branch information
lucagiove authored Nov 14, 2023
2 parents b8a87e3 + bd42530 commit 01cab99
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 2.7, 3.7, 3.8, 3.x ]
python-version: [ 3.7, 3.8, 3.x ]
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion atests/http_server/run.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off
set FLASK_APP=core.py
python -m flask run
python -m flask run --port 5010
2 changes: 1 addition & 1 deletion atests/http_server/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
export FLASK_APP=core.py
python -m flask run
python -m flask run --port 5010
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}
2 changes: 1 addition & 1 deletion atests/res_setup.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Library RequestsLibrary

*** Variables ***
${GLOBAL_SESSION} global_session
${HTTP_LOCAL_SERVER} http://localhost:5000
${HTTP_LOCAL_SERVER} http://localhost:5010


*** Keywords ***
Expand Down
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 01cab99

Please sign in to comment.