Skip to content

Commit

Permalink
Clean the state pollution in TestMainView.test_warning with monkeypatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sturmianseq committed Aug 7, 2021
1 parent d08200d commit 851b6d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def check_status(self):
assert response['content-type'] == 'text/html; charset=utf-8'
assert b'Super Fail!' in response.content

def test_warning(self, client):
def test_warning(self, client, monkeypatch):
class MyBackend(BaseHealthCheckBackend):
def check_status(self):
raise ServiceWarning('so so')
Expand All @@ -110,7 +110,7 @@ def check_status(self):
assert response.status_code == 500, response.content.decode('utf-8')
assert b'so so' in response.content, response.content

HEALTH_CHECK['WARNINGS_AS_ERRORS'] = False
monkeypatch.setitem(HEALTH_CHECK, 'WARNINGS_AS_ERRORS', False)

response = client.get(self.url)
assert response.status_code == 200, response.content.decode('utf-8')
Expand Down

0 comments on commit 851b6d1

Please sign in to comment.