# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import os
from typing import Any, cast

import pytest

from stigg import Stigg, AsyncStigg
from tests.utils import assert_matches_type
from stigg._utils import parse_datetime
from stigg.types.v1 import (
    CustomerResponse,
    CustomerListResponse,
    CustomerImportResponse,
    CustomerListResourcesResponse,
)
from stigg.pagination import SyncMyCursorIDPage, AsyncMyCursorIDPage

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")


class TestCustomers:
    parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_retrieve(self, client: Stigg) -> None:
        customer = client.v1.customers.retrieve(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_retrieve(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.retrieve(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_retrieve(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.retrieve(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_path_params_retrieve(self, client: Stigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.v1.customers.with_raw_response.retrieve(
                "",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_update(self, client: Stigg) -> None:
        customer = client.v1.customers.update(
            id="x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_update_with_all_params(self, client: Stigg) -> None:
        customer = client.v1.customers.update(
            id="x",
            billing_currency="usd",
            billing_id="billingId",
            coupon_id="couponId",
            email="dev@stainless.com",
            integrations=[
                {
                    "id": "id",
                    "synced_entity_id": "syncedEntityId",
                    "vendor_identifier": "AUTH0",
                }
            ],
            language="language",
            metadata={"foo": "string"},
            name="name",
            passthrough={
                "stripe": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "customer_name": "customerName",
                    "invoice_custom_fields": {"foo": "string"},
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "shipping_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "tax_ids": [
                        {
                            "type": "type",
                            "value": "value",
                        }
                    ],
                },
                "zuora": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "currency": "usd",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                },
            },
            timezone="timezone",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_update(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.update(
            id="x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_update(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.update(
            id="x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_path_params_update(self, client: Stigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.v1.customers.with_raw_response.update(
                id="",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_list(self, client: Stigg) -> None:
        customer = client.v1.customers.list()
        assert_matches_type(SyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_list_with_all_params(self, client: Stigg) -> None:
        customer = client.v1.customers.list(
            after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            created_at={
                "gt": parse_datetime("2019-12-27T18:11:19.117Z"),
                "gte": parse_datetime("2019-12-27T18:11:19.117Z"),
                "lt": parse_datetime("2019-12-27T18:11:19.117Z"),
                "lte": parse_datetime("2019-12-27T18:11:19.117Z"),
            },
            email="email",
            limit=1,
            name="name",
        )
        assert_matches_type(SyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_list(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.list()

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(SyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_list(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.list() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(SyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_archive(self, client: Stigg) -> None:
        customer = client.v1.customers.archive(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_archive(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.archive(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_archive(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.archive(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_path_params_archive(self, client: Stigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.v1.customers.with_raw_response.archive(
                "",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_import(self, client: Stigg) -> None:
        customer = client.v1.customers.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        )
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_import_with_all_params(self, client: Stigg) -> None:
        customer = client.v1.customers.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                    "billing_id": "billingId",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "salesforce_id": "salesforceId",
                    "updated_at": parse_datetime("2019-12-27T18:11:19.117Z"),
                }
            ],
            integration_id="integrationId",
        )
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_import(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_import(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerImportResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_list_resources(self, client: Stigg) -> None:
        customer = client.v1.customers.list_resources(
            id="x",
        )
        assert_matches_type(SyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_list_resources_with_all_params(self, client: Stigg) -> None:
        customer = client.v1.customers.list_resources(
            id="x",
            after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            limit=1,
        )
        assert_matches_type(SyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_list_resources(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.list_resources(
            id="x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(SyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_list_resources(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.list_resources(
            id="x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(SyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_path_params_list_resources(self, client: Stigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.v1.customers.with_raw_response.list_resources(
                id="",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_provision(self, client: Stigg) -> None:
        customer = client.v1.customers.provision(
            id="id",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_provision_with_all_params(self, client: Stigg) -> None:
        customer = client.v1.customers.provision(
            id="id",
            billing_currency="usd",
            billing_id="billingId",
            coupon_id="couponId",
            default_payment_method={
                "billing_id": "billingId",
                "card_expiry_month": 0,
                "card_expiry_year": 0,
                "card_last4_digits": "cardLast4Digits",
                "type": "CARD",
            },
            email="dev@stainless.com",
            integrations=[
                {
                    "id": "id",
                    "synced_entity_id": "syncedEntityId",
                    "vendor_identifier": "AUTH0",
                }
            ],
            language="language",
            metadata={"foo": "string"},
            name="name",
            passthrough={
                "stripe": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "customer_name": "customerName",
                    "invoice_custom_fields": {"foo": "string"},
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "shipping_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "tax_ids": [
                        {
                            "type": "type",
                            "value": "value",
                        }
                    ],
                },
                "zuora": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "currency": "usd",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                },
            },
            timezone="timezone",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_provision(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.provision(
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_provision(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.provision(
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_method_unarchive(self, client: Stigg) -> None:
        customer = client.v1.customers.unarchive(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_raw_response_unarchive(self, client: Stigg) -> None:
        response = client.v1.customers.with_raw_response.unarchive(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_streaming_response_unarchive(self, client: Stigg) -> None:
        with client.v1.customers.with_streaming_response.unarchive(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    def test_path_params_unarchive(self, client: Stigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.v1.customers.with_raw_response.unarchive(
                "",
            )


class TestAsyncCustomers:
    parametrize = pytest.mark.parametrize(
        "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
    )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_retrieve(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.retrieve(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_retrieve(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.retrieve(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_retrieve(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.retrieve(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_path_params_retrieve(self, async_client: AsyncStigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.v1.customers.with_raw_response.retrieve(
                "",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_update(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.update(
            id="x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_update_with_all_params(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.update(
            id="x",
            billing_currency="usd",
            billing_id="billingId",
            coupon_id="couponId",
            email="dev@stainless.com",
            integrations=[
                {
                    "id": "id",
                    "synced_entity_id": "syncedEntityId",
                    "vendor_identifier": "AUTH0",
                }
            ],
            language="language",
            metadata={"foo": "string"},
            name="name",
            passthrough={
                "stripe": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "customer_name": "customerName",
                    "invoice_custom_fields": {"foo": "string"},
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "shipping_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "tax_ids": [
                        {
                            "type": "type",
                            "value": "value",
                        }
                    ],
                },
                "zuora": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "currency": "usd",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                },
            },
            timezone="timezone",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_update(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.update(
            id="x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_update(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.update(
            id="x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_path_params_update(self, async_client: AsyncStigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.v1.customers.with_raw_response.update(
                id="",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_list(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.list()
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_list_with_all_params(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.list(
            after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            created_at={
                "gt": parse_datetime("2019-12-27T18:11:19.117Z"),
                "gte": parse_datetime("2019-12-27T18:11:19.117Z"),
                "lt": parse_datetime("2019-12-27T18:11:19.117Z"),
                "lte": parse_datetime("2019-12-27T18:11:19.117Z"),
            },
            email="email",
            limit=1,
            name="name",
        )
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_list(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.list()

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.list() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(AsyncMyCursorIDPage[CustomerListResponse], customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_archive(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.archive(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_archive(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.archive(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_archive(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.archive(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_path_params_archive(self, async_client: AsyncStigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.v1.customers.with_raw_response.archive(
                "",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_import(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        )
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_import_with_all_params(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                    "billing_id": "billingId",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "salesforce_id": "salesforceId",
                    "updated_at": parse_datetime("2019-12-27T18:11:19.117Z"),
                }
            ],
            integration_id="integrationId",
        )
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_import(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerImportResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_import(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.import_(
            customers=[
                {
                    "id": "id",
                    "email": "dev@stainless.com",
                    "name": "name",
                }
            ],
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerImportResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_list_resources(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.list_resources(
            id="x",
        )
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_list_resources_with_all_params(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.list_resources(
            id="x",
            after="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            before="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            limit=1,
        )
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_list_resources(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.list_resources(
            id="x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(AsyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_list_resources(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.list_resources(
            id="x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(AsyncMyCursorIDPage[CustomerListResourcesResponse], customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_path_params_list_resources(self, async_client: AsyncStigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.v1.customers.with_raw_response.list_resources(
                id="",
            )

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_provision(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.provision(
            id="id",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_provision_with_all_params(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.provision(
            id="id",
            billing_currency="usd",
            billing_id="billingId",
            coupon_id="couponId",
            default_payment_method={
                "billing_id": "billingId",
                "card_expiry_month": 0,
                "card_expiry_year": 0,
                "card_last4_digits": "cardLast4Digits",
                "type": "CARD",
            },
            email="dev@stainless.com",
            integrations=[
                {
                    "id": "id",
                    "synced_entity_id": "syncedEntityId",
                    "vendor_identifier": "AUTH0",
                }
            ],
            language="language",
            metadata={"foo": "string"},
            name="name",
            passthrough={
                "stripe": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "customer_name": "customerName",
                    "invoice_custom_fields": {"foo": "string"},
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                    "shipping_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "tax_ids": [
                        {
                            "type": "type",
                            "value": "value",
                        }
                    ],
                },
                "zuora": {
                    "billing_address": {
                        "city": "city",
                        "country": "country",
                        "line1": "line1",
                        "line2": "line2",
                        "postal_code": "postalCode",
                        "state": "state",
                    },
                    "currency": "usd",
                    "metadata": {"foo": "string"},
                    "payment_method_id": "paymentMethodId",
                },
            },
            timezone="timezone",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_provision(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.provision(
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_provision(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.provision(
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_method_unarchive(self, async_client: AsyncStigg) -> None:
        customer = await async_client.v1.customers.unarchive(
            "x",
        )
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_raw_response_unarchive(self, async_client: AsyncStigg) -> None:
        response = await async_client.v1.customers.with_raw_response.unarchive(
            "x",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        customer = await response.parse()
        assert_matches_type(CustomerResponse, customer, path=["response"])

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_streaming_response_unarchive(self, async_client: AsyncStigg) -> None:
        async with async_client.v1.customers.with_streaming_response.unarchive(
            "x",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            customer = await response.parse()
            assert_matches_type(CustomerResponse, customer, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip(reason="Mock server tests are disabled")
    @parametrize
    async def test_path_params_unarchive(self, async_client: AsyncStigg) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.v1.customers.with_raw_response.unarchive(
                "",
            )
