|
@@ -7,13 +7,13 @@ DEFAULT_PUSH_URL = 'https://example.uptime.kuma/api/push/abcd1234'
|
|
|
CUSTOM_PUSH_URL = 'https://uptime.example.com/api/push/efgh5678'
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_hits_default_uptimekuma_on_fail():
|
|
|
+def test_push_monitor_hits_default_uptimekuma_on_fail():
|
|
|
hook_config = {}
|
|
|
flexmock(module.requests).should_receive('get').with_args(
|
|
|
f'{DEFAULT_PUSH_URL}?status=down&msg=fail'
|
|
|
).and_return(flexmock(ok=True)).once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -23,13 +23,13 @@ def test_ping_monitor_hits_default_uptimekuma_on_fail():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_hits_custom_uptimekuma_on_fail():
|
|
|
+def test_push_monitor_hits_custom_uptimekuma_on_fail():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').with_args(
|
|
|
f'{CUSTOM_PUSH_URL}?status=down&msg=fail'
|
|
|
).and_return(flexmock(ok=True)).once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -39,13 +39,13 @@ def test_ping_monitor_hits_custom_uptimekuma_on_fail():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_custom_uptimekuma_on_start():
|
|
|
+def test_push_monitor_custom_uptimekuma_on_start():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').with_args(
|
|
|
f'{CUSTOM_PUSH_URL}?status=up&msg=start'
|
|
|
).and_return(flexmock(ok=True)).once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -55,13 +55,13 @@ def test_ping_monitor_custom_uptimekuma_on_start():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_custom_uptimekuma_on_finish():
|
|
|
+def test_push_monitor_custom_uptimekuma_on_finish():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').with_args(
|
|
|
f'{CUSTOM_PUSH_URL}?status=up&msg=finish'
|
|
|
).and_return(flexmock(ok=True)).once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -71,11 +71,11 @@ def test_ping_monitor_custom_uptimekuma_on_finish():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_does_not_hit_custom_uptimekuma_on_fail_dry_run():
|
|
|
+def test_push_monitor_does_not_hit_custom_uptimekuma_on_fail_dry_run():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').never()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -85,11 +85,11 @@ def test_ping_monitor_does_not_hit_custom_uptimekuma_on_fail_dry_run():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_does_not_hit_custom_uptimekuma_on_start_dry_run():
|
|
|
+def test_push_monitor_does_not_hit_custom_uptimekuma_on_start_dry_run():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').never()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -99,11 +99,11 @@ def test_ping_monitor_does_not_hit_custom_uptimekuma_on_start_dry_run():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_does_not_hit_custom_uptimekuma_on_finish_dry_run():
|
|
|
+def test_push_monitor_does_not_hit_custom_uptimekuma_on_finish_dry_run():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').never()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -113,14 +113,14 @@ def test_ping_monitor_does_not_hit_custom_uptimekuma_on_finish_dry_run():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_with_connection_error_logs_warning():
|
|
|
+def test_push_monitor_with_connection_error_logs_warning():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').with_args(
|
|
|
f'{CUSTOM_PUSH_URL}?status=down&msg=fail'
|
|
|
).and_raise(module.requests.exceptions.ConnectionError)
|
|
|
flexmock(module.logger).should_receive('warning').once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -130,7 +130,7 @@ def test_ping_monitor_with_connection_error_logs_warning():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_with_other_error_logs_warning():
|
|
|
+def test_push_monitor_with_other_error_logs_warning():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
response = flexmock(ok=False)
|
|
|
response.should_receive('raise_for_status').and_raise(
|
|
@@ -141,7 +141,7 @@ def test_ping_monitor_with_other_error_logs_warning():
|
|
|
).and_return(response)
|
|
|
flexmock(module.logger).should_receive('warning').once()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|
|
@@ -151,11 +151,11 @@ def test_ping_monitor_with_other_error_logs_warning():
|
|
|
)
|
|
|
|
|
|
|
|
|
-def test_ping_monitor_with_invalid_run_state():
|
|
|
+def test_push_monitor_with_invalid_run_state():
|
|
|
hook_config = {'push_url': CUSTOM_PUSH_URL}
|
|
|
flexmock(module.requests).should_receive('get').never()
|
|
|
|
|
|
- module.ping_monitor(
|
|
|
+ module.push_monitor(
|
|
|
hook_config,
|
|
|
{},
|
|
|
'config.yaml',
|