# This file is auto-generated by oagen. Do not edit.

"""Model round-trip tests: from_dict(to_dict()) preserves data."""

from tests.generated_helpers import load_fixture

from workos.webhooks.models import WebhookEndpoint


class TestModelRoundTrip:
    def test_webhook_endpoint_round_trip(self):
        data = load_fixture("webhook_endpoint.json")
        instance = WebhookEndpoint.from_dict(data)
        serialized = instance.to_dict()
        assert serialized == data
        restored = WebhookEndpoint.from_dict(serialized)
        assert restored.to_dict() == serialized

    def test_webhook_endpoint_minimal_payload(self):
        data = {
            "object": "webhook_endpoint",
            "id": "we_0123456789",
            "endpoint_url": "https://example.com/webhooks",
            "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4",
            "status": "enabled",
            "events": ["user.created", "dsync.user.created"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WebhookEndpoint.from_dict(data)
        serialized = instance.to_dict()
        assert serialized["object"] == data["object"]
        assert serialized["id"] == data["id"]
        assert serialized["endpoint_url"] == data["endpoint_url"]
        assert serialized["secret"] == data["secret"]
        assert serialized["status"] == data["status"]
        assert serialized["events"] == data["events"]
        assert serialized["created_at"] == data["created_at"]
        assert serialized["updated_at"] == data["updated_at"]

    def test_webhook_endpoint_round_trips_unknown_enum_values(self):
        data = {
            "object": "webhook_endpoint",
            "id": "we_0123456789",
            "endpoint_url": "https://example.com/webhooks",
            "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4",
            "status": "unexpected_webhook_endpoint_status",
            "events": ["user.created", "dsync.user.created"],
            "created_at": "2026-01-15T12:00:00.000Z",
            "updated_at": "2026-01-15T12:00:00.000Z",
        }
        instance = WebhookEndpoint.from_dict(data)
        assert instance.to_dict() == data
