Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions keep/providers/webhook_provider/webhook_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,12 @@ def dispose(self):

def validate_scopes(self) -> dict[str, bool | str]:
validated_scopes = {}
# try to send the webhook with TEST payload
try:
self._notify(body={"test": "payload"})
self.__validate_url(str(self.authentication_config.url))
validated_scopes["send_webhook"] = True
except Exception as e:
self.logger.exception("Error validating scopes")
self.logger.exception("Error validating webhook URL")
validated_scopes["send_webhook"] = str(e)
return validated_scopes
validated_scopes["send_webhook"] = True
return validated_scopes

def validate_config(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e_tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,16 @@ def test_provider_deletion(browser: Page):
f"button:has-text('Webhook'):has-text('Connected'):has-text('{provider_name}')"
).click()
browser.get_by_placeholder("Enter url").clear()
browser.get_by_placeholder("Enter url").fill("https://this_is_UwU")
# Use a blacklisted URL to trigger validation error
browser.get_by_placeholder("Enter url").fill("https://metadata.google.internal/test")

browser.get_by_role("button", name="Update", exact=True).click()
browser.wait_for_timeout(500)
# Refreshing the scope
browser.get_by_role("button", name="Validate Scopes", exact=True).click()
browser.wait_for_timeout(500)
assert_scope_text_count(
browser=browser, contains_text="HTTPSConnectionPool", count=1
browser=browser, contains_text="blacklisted", count=1
)
browser.mouse.click(10, 10)
delete_provider(
Expand Down
Loading