# Path: pyuploadcare/api/entities.py
# class Webhook(Entity):
#     id: int
#     created: Optional[datetime]
#     updated: Optional[datetime]
#     event: Optional[str]
#     target_url: Optional[str]
#     project: Optional[str]
#     is_active: Optional[bool]
#     signing_secret: Optional[str]


import pytest
from pyuploadcare.api.entities import Webhook



@pytest.mark.vcr
def test_client_create_webhook(uploadcare):
    webhook = uploadcare.create_webhook(
        target_url="https://webhook.site/699ba5a4-b178-41c7-b416-5d1b6739d052"
    )
    assert isinstance(webhook, Webhook)


@pytest.mark.vcr
def test_list_webhooks(uploadcare):
    webhooks = list(uploadcare.list_webhooks(limit=1))

# Path: pyuploadcare/api/entities.py
# class Webhook(Entity):
#     id: int
#     created: Optional[datetime]
#     updated: Optional[datetime]
#     event: Optional[str]
#     target_url: Optional[str]
#     project: Optional[str]
#     is_active: Optional[bool]
#     signing_secret: Optional[str]


# Path: tests/functional/resources/test_webhooks.py
import pytest
from pyuploadcare.api.entities import Webhook




@pytest.mark.vcr
def test_client_create_webhook(uploadcare):
    webhook = uploadcare.create_webhook(
        target_url="https://webhook.site/699ba5a4-b178-41c7-b416-5d1b6739d052"
    )
    assert isinstance(webhook, Webhook)


@pytest.mark.vcr
def test_list_webhooks(uploadcare):
    webhooks = list(uploadcare.list_webhooks(limit=1))

    assert len(webhooks) == 1