# 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 ali_test_2 import AliTest2, AsyncAliTest2
from tests.utils import assert_matches_type
from ali_test_2.types.api.v2.customers import (
    Bookmark,
    BookmarkListResponse,
    BookmarkUpdateResponse,
)

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


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

    @pytest.mark.skip()
    @parametrize
    def test_method_create(self, client: AliTest2) -> None:
        bookmark = client.api.v2.customers.bookmarks.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        )
        assert_matches_type(Bookmark, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_create(self, client: AliTest2) -> None:
        response = client.api.v2.customers.bookmarks.with_raw_response.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        )

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_create(self, client: AliTest2) -> None:
        with client.api.v2.customers.bookmarks.with_streaming_response.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = response.parse()
            assert_matches_type(Bookmark, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_create(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.bookmarks.with_raw_response.create(
                customer_id="",
                id=0,
                _type="Show",
            )

    @pytest.mark.skip()
    @parametrize
    def test_method_update(self, client: AliTest2) -> None:
        bookmark = client.api.v2.customers.bookmarks.update(
            bookmark_id=0,
            customer_id="customerId",
        )
        assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_method_update_with_all_params(self, client: AliTest2) -> None:
        bookmark = client.api.v2.customers.bookmarks.update(
            bookmark_id=0,
            customer_id="customerId",
            has_seen=True,
        )
        assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_update(self, client: AliTest2) -> None:
        response = client.api.v2.customers.bookmarks.with_raw_response.update(
            bookmark_id=0,
            customer_id="customerId",
        )

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_update(self, client: AliTest2) -> None:
        with client.api.v2.customers.bookmarks.with_streaming_response.update(
            bookmark_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = response.parse()
            assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_update(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.bookmarks.with_raw_response.update(
                bookmark_id=0,
                customer_id="",
            )

    @pytest.mark.skip()
    @parametrize
    def test_method_list(self, client: AliTest2) -> None:
        bookmark = client.api.v2.customers.bookmarks.list(
            customer_id="customerId",
            location=0,
        )
        assert_matches_type(BookmarkListResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_list(self, client: AliTest2) -> None:
        response = client.api.v2.customers.bookmarks.with_raw_response.list(
            customer_id="customerId",
            location=0,
        )

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_list(self, client: AliTest2) -> None:
        with client.api.v2.customers.bookmarks.with_streaming_response.list(
            customer_id="customerId",
            location=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = response.parse()
            assert_matches_type(BookmarkListResponse, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_list(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.bookmarks.with_raw_response.list(
                customer_id="",
                location=0,
            )

    @pytest.mark.skip()
    @parametrize
    def test_method_delete(self, client: AliTest2) -> None:
        bookmark = client.api.v2.customers.bookmarks.delete(
            bookmark_id=0,
            customer_id="customerId",
        )
        assert bookmark is None

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_delete(self, client: AliTest2) -> None:
        response = client.api.v2.customers.bookmarks.with_raw_response.delete(
            bookmark_id=0,
            customer_id="customerId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        bookmark = response.parse()
        assert bookmark is None

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_delete(self, client: AliTest2) -> None:
        with client.api.v2.customers.bookmarks.with_streaming_response.delete(
            bookmark_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = response.parse()
            assert bookmark is None

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_path_params_delete(self, client: AliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            client.api.v2.customers.bookmarks.with_raw_response.delete(
                bookmark_id=0,
                customer_id="",
            )


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

    @pytest.mark.skip()
    @parametrize
    async def test_method_create(self, async_client: AsyncAliTest2) -> None:
        bookmark = await async_client.api.v2.customers.bookmarks.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        )
        assert_matches_type(Bookmark, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_create(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.bookmarks.with_raw_response.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        )

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_create(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.bookmarks.with_streaming_response.create(
            customer_id="customerId",
            id=0,
            _type="Show",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = await response.parse()
            assert_matches_type(Bookmark, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_create(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.bookmarks.with_raw_response.create(
                customer_id="",
                id=0,
                _type="Show",
            )

    @pytest.mark.skip()
    @parametrize
    async def test_method_update(self, async_client: AsyncAliTest2) -> None:
        bookmark = await async_client.api.v2.customers.bookmarks.update(
            bookmark_id=0,
            customer_id="customerId",
        )
        assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_method_update_with_all_params(self, async_client: AsyncAliTest2) -> None:
        bookmark = await async_client.api.v2.customers.bookmarks.update(
            bookmark_id=0,
            customer_id="customerId",
            has_seen=True,
        )
        assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_update(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.bookmarks.with_raw_response.update(
            bookmark_id=0,
            customer_id="customerId",
        )

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_update(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.bookmarks.with_streaming_response.update(
            bookmark_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = await response.parse()
            assert_matches_type(BookmarkUpdateResponse, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_update(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.bookmarks.with_raw_response.update(
                bookmark_id=0,
                customer_id="",
            )

    @pytest.mark.skip()
    @parametrize
    async def test_method_list(self, async_client: AsyncAliTest2) -> None:
        bookmark = await async_client.api.v2.customers.bookmarks.list(
            customer_id="customerId",
            location=0,
        )
        assert_matches_type(BookmarkListResponse, bookmark, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_list(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.bookmarks.with_raw_response.list(
            customer_id="customerId",
            location=0,
        )

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.bookmarks.with_streaming_response.list(
            customer_id="customerId",
            location=0,
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = await response.parse()
            assert_matches_type(BookmarkListResponse, bookmark, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_list(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.bookmarks.with_raw_response.list(
                customer_id="",
                location=0,
            )

    @pytest.mark.skip()
    @parametrize
    async def test_method_delete(self, async_client: AsyncAliTest2) -> None:
        bookmark = await async_client.api.v2.customers.bookmarks.delete(
            bookmark_id=0,
            customer_id="customerId",
        )
        assert bookmark is None

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_delete(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.api.v2.customers.bookmarks.with_raw_response.delete(
            bookmark_id=0,
            customer_id="customerId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        bookmark = await response.parse()
        assert bookmark is None

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_delete(self, async_client: AsyncAliTest2) -> None:
        async with async_client.api.v2.customers.bookmarks.with_streaming_response.delete(
            bookmark_id=0,
            customer_id="customerId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            bookmark = await response.parse()
            assert bookmark is None

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_path_params_delete(self, async_client: AsyncAliTest2) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `customer_id` but received ''"):
            await async_client.api.v2.customers.bookmarks.with_raw_response.delete(
                bookmark_id=0,
                customer_id="",
            )
