# 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.feeds import V2ListShowsResponse

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


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

    @pytest.mark.skip()
    @parametrize
    def test_method_list_shows(self, client: AliTest2) -> None:
        v2 = client.feeds.v2.list_shows()
        assert_matches_type(V2ListShowsResponse, v2, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_method_list_shows_with_all_params(self, client: AliTest2) -> None:
        v2 = client.feeds.v2.list_shows(
            location="location",
        )
        assert_matches_type(V2ListShowsResponse, v2, path=["response"])

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_list_shows(self, client: AliTest2) -> None:
        response = client.feeds.v2.with_raw_response.list_shows()

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_list_shows(self, client: AliTest2) -> None:
        with client.feeds.v2.with_streaming_response.list_shows() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            v2 = response.parse()
            assert_matches_type(V2ListShowsResponse, v2, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_feed(self, client: AliTest2) -> None:
        v2 = client.feeds.v2.retrieve_feed(
            type="FACEBOOK",
        )
        assert v2 is None

    @pytest.mark.skip()
    @parametrize
    def test_method_retrieve_feed_with_all_params(self, client: AliTest2) -> None:
        v2 = client.feeds.v2.retrieve_feed(
            type="FACEBOOK",
            include_shows_without_allocations=True,
            location="location",
            sort_by="MAX_DISCOUNT_PERCENTAGE",
            sort_order="ASC",
        )
        assert v2 is None

    @pytest.mark.skip()
    @parametrize
    def test_raw_response_retrieve_feed(self, client: AliTest2) -> None:
        response = client.feeds.v2.with_raw_response.retrieve_feed(
            type="FACEBOOK",
        )

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

    @pytest.mark.skip()
    @parametrize
    def test_streaming_response_retrieve_feed(self, client: AliTest2) -> None:
        with client.feeds.v2.with_streaming_response.retrieve_feed(
            type="FACEBOOK",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            v2 = response.parse()
            assert v2 is None

        assert cast(Any, response.is_closed) is True


class TestAsyncV2:
    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_list_shows(self, async_client: AsyncAliTest2) -> None:
        v2 = await async_client.feeds.v2.list_shows()
        assert_matches_type(V2ListShowsResponse, v2, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_method_list_shows_with_all_params(self, async_client: AsyncAliTest2) -> None:
        v2 = await async_client.feeds.v2.list_shows(
            location="location",
        )
        assert_matches_type(V2ListShowsResponse, v2, path=["response"])

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_list_shows(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.feeds.v2.with_raw_response.list_shows()

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_list_shows(self, async_client: AsyncAliTest2) -> None:
        async with async_client.feeds.v2.with_streaming_response.list_shows() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            v2 = await response.parse()
            assert_matches_type(V2ListShowsResponse, v2, path=["response"])

        assert cast(Any, response.is_closed) is True

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_feed(self, async_client: AsyncAliTest2) -> None:
        v2 = await async_client.feeds.v2.retrieve_feed(
            type="FACEBOOK",
        )
        assert v2 is None

    @pytest.mark.skip()
    @parametrize
    async def test_method_retrieve_feed_with_all_params(self, async_client: AsyncAliTest2) -> None:
        v2 = await async_client.feeds.v2.retrieve_feed(
            type="FACEBOOK",
            include_shows_without_allocations=True,
            location="location",
            sort_by="MAX_DISCOUNT_PERCENTAGE",
            sort_order="ASC",
        )
        assert v2 is None

    @pytest.mark.skip()
    @parametrize
    async def test_raw_response_retrieve_feed(self, async_client: AsyncAliTest2) -> None:
        response = await async_client.feeds.v2.with_raw_response.retrieve_feed(
            type="FACEBOOK",
        )

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

    @pytest.mark.skip()
    @parametrize
    async def test_streaming_response_retrieve_feed(self, async_client: AsyncAliTest2) -> None:
        async with async_client.feeds.v2.with_streaming_response.retrieve_feed(
            type="FACEBOOK",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

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

        assert cast(Any, response.is_closed) is True
