-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af10d61
commit 339aa06
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,23 @@ | ||
import unittest | ||
|
||
from health_check.contrib.db_heartbeat import DatabaseHeartBeatCheck | ||
from health_check.exceptions import ServiceUnavailable | ||
|
||
|
||
class TestDatabaseHeartBeatCheck(unittest.TestCase): | ||
|
||
def test_check_status_success(self): | ||
health_check = DatabaseHeartBeatCheck() | ||
try: | ||
health_check.check_status() # Should pass without exceptions | ||
except Exception as e: | ||
self.fail(f"check_status() raised an exception unexpectedly: {e}") | ||
|
||
def test_check_status_unexpected_result(self): | ||
health_check = DatabaseHeartBeatCheck() | ||
with self.assertRaises(ServiceUnavailable): | ||
health_check.check_status() | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains 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