mirror of
https://github.com/mtan93/cachet-url-monitor.git
synced 2026-05-12 14:26:06 +01:00
83 (#84)
* #83 - Fixing the bug that was preventing the status update * #83 - Refactoring unit tests for configuration to ensure we catch more cases
This commit is contained in:
@@ -5,8 +5,7 @@ import unittest
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from cachet_url_monitor.configuration import HttpStatus, Regex
|
||||
from cachet_url_monitor.configuration import Latency
|
||||
from cachet_url_monitor.expectation import HttpStatus, Regex, Latency
|
||||
from cachet_url_monitor.status import ComponentStatus
|
||||
|
||||
|
||||
@@ -76,12 +75,24 @@ class HttpStatusTest(unittest.TestCase):
|
||||
|
||||
assert self.expectation.get_status(request) == ComponentStatus.OPERATIONAL
|
||||
|
||||
def test_get_status_healthy_boundary(self):
|
||||
request = mock.Mock()
|
||||
request.status_code = 299
|
||||
|
||||
assert self.expectation.get_status(request) == ComponentStatus.OPERATIONAL
|
||||
|
||||
def test_get_status_unhealthy(self):
|
||||
request = mock.Mock()
|
||||
request.status_code = 400
|
||||
|
||||
assert self.expectation.get_status(request) == ComponentStatus.PARTIAL_OUTAGE
|
||||
|
||||
def test_get_status_unhealthy_boundary(self):
|
||||
request = mock.Mock()
|
||||
request.status_code = 300
|
||||
|
||||
assert self.expectation.get_status(request) == ComponentStatus.PARTIAL_OUTAGE
|
||||
|
||||
def test_get_message(self):
|
||||
request = mock.Mock()
|
||||
request.status_code = 400
|
||||
|
||||
Reference in New Issue
Block a user