Fix tests after refactor
This commit is contained in:
@@ -171,10 +171,12 @@ class TestKumaClient:
|
||||
|
||||
def test_find_monitors_by_pattern_api_error(self, capsys):
|
||||
"""Test finding monitors handles API errors"""
|
||||
from uptime_kuma_api import UptimeKumaException
|
||||
|
||||
client = KumaClient("http://test.com")
|
||||
client.api = Mock()
|
||||
|
||||
client.api.get_monitors.side_effect = Exception("API Error")
|
||||
client.api.get_monitors.side_effect = UptimeKumaException("API Error")
|
||||
|
||||
result = client.find_monitors_by_pattern(["Web*"])
|
||||
assert len(result) == 0
|
||||
@@ -203,7 +205,9 @@ class TestKumaClient:
|
||||
@patch("kumacli.client.UptimeKumaApi")
|
||||
def test_connect_failure(self, mock_api_class, capsys):
|
||||
"""Test connection failure"""
|
||||
mock_api_class.side_effect = Exception("Connection failed")
|
||||
from uptime_kuma_api import UptimeKumaException
|
||||
|
||||
mock_api_class.side_effect = UptimeKumaException("Connection failed")
|
||||
|
||||
client = KumaClient("http://test.com", "user", "pass")
|
||||
result = client.connect()
|
||||
|
Reference in New Issue
Block a user