File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
health_check/contrib/db_heartbeat Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def check_status(self):
2323 result = None
2424 compiler = connection .ops .compiler ("SQLCompiler" )(SelectOne (), connection , None )
2525 with connection .cursor () as cursor :
26- cursor .execute (compiler .compile (SelectOne ()))
26+ cursor .execute (* compiler .compile (SelectOne ()))
2727 result = cursor .fetchone ()
2828
2929 if result != (1 ,):
Original file line number Diff line number Diff line change 11import unittest
22from unittest .mock import MagicMock , patch
33
4+ import pytest
5+
46from health_check .contrib .db_heartbeat .backends import DatabaseHeartBeatCheck , SelectOne
57from health_check .exceptions import ServiceUnavailable
68
@@ -20,8 +22,13 @@ def test_as_oracle(self):
2022
2123
2224class TestDatabaseHeartBeatCheck (unittest .TestCase ):
25+ @pytest .mark .django_db
26+ def test_check_status__success (self ):
27+ health_check = DatabaseHeartBeatCheck ()
28+ health_check .check_status ()
29+
2330 @patch ("health_check.contrib.db_heartbeat.backends.connection" )
24- def test_check_status_success (self , mock_connection ):
31+ def test_check_status__failure (self , mock_connection ):
2532 mock_cursor = MagicMock ()
2633 mock_cursor .fetchone .return_value = (1 ,)
2734 mock_connection .cursor .return_value .__enter__ .return_value = mock_cursor
You can’t perform that action at this time.
0 commit comments