Fix Healthchecks UUID regex

This commit is contained in:
estebanthilliez 2024-04-22 20:44:20 +02:00
parent 2e4c0cc7e7
commit cfdc0a1f2a
2 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
)
return
ping_url_is_uuid = re.match(r'(\w{4}-?){4}$', hook_config['ping_url'])
ping_url_is_uuid = re.search(r'\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$', ping_url)
healthchecks_state = MONITOR_STATE_TO_HEALTHCHECKS.get(state)
if healthchecks_state:

View File

@ -299,7 +299,7 @@ def test_ping_monitor_does_not_add_create_query_parameter_when_create_slug_false
def test_ping_monitor_does_not_add_create_query_parameter_when_ping_url_is_uuid():
hook_config = {'ping_url': 'abcd-efgh-ijkl-mnop', 'create_slug': True}
hook_config = {'ping_url': 'b3611b24-df9c-4d36-9203-fa292820bf2a', 'create_slug': True}
flexmock(module.requests).should_receive('post').with_args(
f"https://hc-ping.com/{hook_config['ping_url']}",
data=''.encode('utf-8'),