Add tests for OAuth client and webhook notification handling

- Implement tests for `EbayOAuthClient` to verify authorization URL generation with configured scopes and token reuse logic.
- Add tests for `WebhookChallengeHandler` to ensure correct SHA256 response generation and for `WebhookSignatureParser` to validate extraction of known fields from signature strings.
This commit is contained in:
claudi 2026-04-07 08:40:50 +02:00
commit 389d72a136
519 changed files with 99006 additions and 0 deletions

View file

@ -0,0 +1,24 @@
from __future__ import annotations
from ebay_client.notification.webhook import WebhookChallengeHandler, WebhookSignatureParser
def test_challenge_handler_builds_sha256_response() -> None:
response = WebhookChallengeHandler.build_challenge_response(
challenge_code="challenge",
verification_token="verification",
endpoint="https://example.test/webhook",
)
assert len(response) == 64
def test_signature_parser_extracts_known_fields() -> None:
parser = WebhookSignatureParser()
parsed = parser.parse("kid=public-key-1,alg=ECDSA,digest=SHA256,sig=Zm9v")
assert parsed.key_id == "public-key-1"
assert parsed.algorithm == "ECDSA"
assert parsed.digest == "SHA256"
assert parsed.signature == b"foo"