diff --git a/argilla-server/tests/unit/api/handlers/v1/webhooks/test_create_webhook.py b/argilla-server/tests/unit/api/handlers/v1/webhooks/test_create_webhook.py index 5b076b2d85..6fb2b51717 100644 --- a/argilla-server/tests/unit/api/handlers/v1/webhooks/test_create_webhook.py +++ b/argilla-server/tests/unit/api/handlers/v1/webhooks/test_create_webhook.py @@ -58,6 +58,26 @@ async def test_create_webhook(self, db: AsyncSession, async_client: AsyncClient, "updated_at": webhook.updated_at.isoformat(), } + async def test_create_webhook_with_ip_address_url( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={ + "url": "http://1.1.1.1/webhook", + "events": [WebhookEvent.response_created], + "description": "Test webhook", + }, + ) + + assert response.status_code == 201 + + assert (await db.execute(select(func.count(Webhook.id)))).scalar() == 1 + webhook = (await db.execute(select(Webhook))).scalar_one() + + assert response.json()["url"] == "http://1.1.1.1/webhook" + async def test_create_webhook_as_admin(self, db: AsyncSession, async_client: AsyncClient): admin = await AdminFactory.create() diff --git a/argilla-server/tests/unit/api/handlers/v1/webhooks/test_update_webhook.py b/argilla-server/tests/unit/api/handlers/v1/webhooks/test_update_webhook.py index c615cce9c9..ad2cc0bb30 100644 --- a/argilla-server/tests/unit/api/handlers/v1/webhooks/test_update_webhook.py +++ b/argilla-server/tests/unit/api/handlers/v1/webhooks/test_update_webhook.py @@ -92,6 +92,20 @@ async def test_update_webhook_with_url(self, async_client: AsyncClient, owner_au assert webhook.url == "https://example.com/webhook" + async def test_update_webhook_with_ip_address_url(self, async_client: AsyncClient, owner_auth_header: dict): + webhook = await WebhookFactory.create() + + response = await async_client.patch( + self.url(webhook.id), + headers=owner_auth_header, + json={ + "url": "https://1.1.1.1:9999/webhook", + }, + ) + + assert response.status_code == 200 + assert response.json()["url"] == "https://1.1.1.1:9999/webhook" + async def test_update_webhook_with_events(self, async_client: AsyncClient, owner_auth_header: dict): webhook = await WebhookFactory.create()