Skip to content

Commit 7ddcd16

Browse files
committed
Update test_webhooks.py
1 parent 9d72a36 commit 7ddcd16

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_webhooks.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from typing import Any, Dict
66
from datetime import datetime, timezone
77

8+
import pytest
9+
10+
from browser_use_sdk._compat import PYDANTIC_V2
811
from browser_use_sdk.lib.webhooks import (
912
WebhookTest,
1013
WebhookTestPayload,
@@ -15,6 +18,7 @@
1518
# Signature Creation ---------------------------------------------------------
1619

1720

21+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
1822
def test_create_webhook_signature() -> None:
1923
"""Test webhook signature creation."""
2024
secret = "test-secret-key"
@@ -38,6 +42,7 @@ def test_create_webhook_signature() -> None:
3842
# Webhook Verification --------------------------------------------------------
3943

4044

45+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
4146
def test_verify_webhook_event_signature_valid() -> None:
4247
"""Test webhook signature verification with valid signature."""
4348
secret = "test-secret-key"
@@ -60,6 +65,7 @@ def test_verify_webhook_event_signature_valid() -> None:
6065
assert verified_webhook.payload.test == "ok"
6166

6267

68+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
6369
def test_verify_webhook_event_signature_invalid_signature() -> None:
6470
"""Test webhook signature verification with invalid signature."""
6571
secret = "test-secret-key"
@@ -79,6 +85,7 @@ def test_verify_webhook_event_signature_invalid_signature() -> None:
7985
assert verified_webhook is None
8086

8187

88+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
8289
def test_verify_webhook_event_signature_wrong_secret() -> None:
8390
"""Test webhook signature verification with wrong secret."""
8491

@@ -106,6 +113,7 @@ def test_verify_webhook_event_signature_wrong_secret() -> None:
106113
assert verified_webhook is None
107114

108115

116+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
109117
def test_verify_webhook_event_signature_string_body() -> None:
110118
"""Test webhook signature verification with string body."""
111119
secret = "test-secret-key"
@@ -127,6 +135,7 @@ def test_verify_webhook_event_signature_string_body() -> None:
127135
assert isinstance(verified_webhook, WebhookTest)
128136

129137

138+
@pytest.mark.skipif(not PYDANTIC_V2, reason="Webhook tests only run in Pydantic V2")
130139
def test_verify_webhook_event_signature_invalid_body() -> None:
131140
"""Test webhook signature verification with invalid body."""
132141
secret = "test-secret-key"

0 commit comments

Comments
 (0)