Skip to content
Open
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
7 changes: 6 additions & 1 deletion fintoc/managers/webhook_endpoints_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ class WebhookEndpointsManager(ManagerMixin):
"""Represents a webhook_endpoints manager."""

resource = "webhook_endpoint"
methods = ["list", "get", "create", "update", "delete"]
methods = ["list", "get", "create", "update", "delete", "test"]

def _test(self, identifier, **kwargs):
"""Send a test event to a webhook endpoint."""
path = f"{self._build_path(**kwargs)}/{identifier}/test"
return self._create(path_=path, **kwargs)
11 changes: 11 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,17 @@ def test_webhook_endpoint_delete(self):

assert result == webhook_endpoint_id

def test_webhook_endpoint_test(self):
"""Test sending a test event to a webhook endpoint."""
webhook_endpoint_id = "test_webhook_endpoint_id"
test_data = {"type": "link.credentials_changed"}

result = self.fintoc.webhook_endpoints.test(webhook_endpoint_id, **test_data)

assert result.method == "post"
assert result.url == f"v1/webhook_endpoints/{webhook_endpoint_id}/test"
assert result.json.type == test_data["type"]

def test_v2_accounts_list(self):
"""Test getting all accounts using v2 API."""
accounts = list(self.fintoc.v2.accounts.list())
Expand Down
Loading