diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 4ccd3ed5..e8b00eb1 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -25,4 +25,4 @@ jobs: run: | bash ./bin/publish-pypi env: - PYPI_TOKEN: ${{ secrets.SENT_DM_PYPI_TOKEN || secrets.PYPI_TOKEN }} + PYPI_TOKEN: ${{ secrets.SENT_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 1f08668b..747e6ced 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,4 +18,4 @@ jobs: run: | bash ./bin/check-release-environment env: - PYPI_TOKEN: ${{ secrets.SENT_DM_PYPI_TOKEN || secrets.PYPI_TOKEN }} + PYPI_TOKEN: ${{ secrets.SENT_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b4e9013b..6db19b95 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.16.0" + ".": "0.17.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5e987cb7..fcaa8b6a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-dm-f2cbab8576dd9d0ece91116dcfe1eb190ff0a2ff9334f812d94ad6f3b3afb807.yml -openapi_spec_hash: 1571d3e04a2b043574b91646b4062f3b -config_hash: d8e8429147c4e214ff53c11e7ab2a1a6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-dm-5dc1981aa33b7d68052db07daa5cebe74c5529c2fd24e68d3a8985cfd47626ff.yml +openapi_spec_hash: c6cb3fad43be2bf8ac0165b201c09e76 +config_hash: 405ade725d72d542c60de821a127411b diff --git a/CHANGELOG.md b/CHANGELOG.md index b532606f..83d1836f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.17.0 (2026-03-31) + +Full Changelog: [v0.16.0...v0.17.0](https://github.com/sentdm/sent-dm-python/compare/v0.16.0...v0.17.0) + +### Features + +* **api:** manual updates ([68ae892](https://github.com/sentdm/sent-dm-python/commit/68ae892e39df4a704a64db9687a4ff5f9d2de22f)) + ## 0.16.0 (2026-03-31) Full Changelog: [v0.15.0...v0.16.0](https://github.com/sentdm/sent-dm-python/compare/v0.15.0...v0.16.0) diff --git a/LICENSE b/LICENSE index e01a1d64..53c5611a 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2026 Sent Dm + Copyright 2026 Sent Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index b6919f58..4ac4bac7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Sent Dm Python API library +# Sent Python API library [![PyPI version](https://img.shields.io/pypi/v/sentdm.svg?label=pypi%20(stable))](https://pypi.org/project/sentdm/) -The Sent Dm Python library provides convenient access to the Sent Dm REST API from any Python 3.9+ +The Sent Python library provides convenient access to the Sent REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/). ## MCP Server -Use the Sent Dm MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. +Use the Sent MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40sentdm%2Fsentdm-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZW50ZG0vc2VudGRtLW1jcCJdLCJlbnYiOnsiU0VOVF9ETV9BUElfS0VZIjoiTXkgQVBJIEtleSJ9fQ) [![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40sentdm%2Fsentdm-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40sentdm%2Fsentdm-mcp%22%5D%2C%22env%22%3A%7B%22SENT_DM_API_KEY%22%3A%22My%20API%20Key%22%7D%7D) @@ -35,9 +35,9 @@ The full API of this library can be found in [api.md](api.md). ```python import os -from sent_dm import SentDm +from sent_dm import Sent -client = SentDm( +client = Sent( api_key=os.environ.get("SENT_DM_API_KEY"), # This is the default and can be omitted ) @@ -63,14 +63,14 @@ so that your API Key is not stored in source control. ## Async usage -Simply import `AsyncSentDm` instead of `SentDm` and use `await` with each API call: +Simply import `AsyncSent` instead of `Sent` and use `await` with each API call: ```python import os import asyncio -from sent_dm import AsyncSentDm +from sent_dm import AsyncSent -client = AsyncSentDm( +client = AsyncSent( api_key=os.environ.get("SENT_DM_API_KEY"), # This is the default and can be omitted ) @@ -113,11 +113,11 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH import os import asyncio from sent_dm import DefaultAioHttpClient -from sent_dm import AsyncSentDm +from sent_dm import AsyncSent async def main() -> None: - async with AsyncSentDm( + async with AsyncSent( api_key=os.environ.get("SENT_DM_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: @@ -153,9 +153,9 @@ Typed requests and responses provide autocomplete and documentation within your Nested parameters are dictionaries, typed using `TypedDict`, for example: ```python -from sent_dm import SentDm +from sent_dm import Sent -client = SentDm() +client = Sent() response = client.messages.send( template={ @@ -181,9 +181,9 @@ All errors inherit from `sent_dm.APIError`. ```python import sent_dm -from sent_dm import SentDm +from sent_dm import Sent -client = SentDm() +client = Sent() try: client.messages.send( @@ -231,10 +231,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ You can use the `max_retries` option to configure or disable retry settings: ```python -from sent_dm import SentDm +from sent_dm import Sent # Configure the default for all requests: -client = SentDm( +client = Sent( # default is 2 max_retries=0, ) @@ -260,16 +260,16 @@ By default requests time out after 1 minute. You can configure this with a `time which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python -from sent_dm import SentDm +from sent_dm import Sent # Configure the default for all requests: -client = SentDm( +client = Sent( # 20 seconds (default is 1 minute) timeout=20.0, ) # More granular control: -client = SentDm( +client = Sent( timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), ) @@ -298,10 +298,10 @@ Note that requests that time out are [retried twice by default](#retries). We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `SENT_DM_LOG` to `info`. +You can enable logging by setting the environment variable `SENT_LOG` to `info`. ```shell -$ export SENT_DM_LOG=info +$ export SENT_LOG=info ``` Or to `debug` for more verbose logging. @@ -323,9 +323,9 @@ if response.my_field is None: The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., ```py -from sent_dm import SentDm +from sent_dm import Sent -client = SentDm() +client = Sent() response = client.messages.with_raw_response.send( channel=["sms"], template={ @@ -419,10 +419,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c ```python import httpx -from sent_dm import SentDm, DefaultHttpxClient +from sent_dm import Sent, DefaultHttpxClient -client = SentDm( - # Or use the `SENT_DM_BASE_URL` env var +client = Sent( + # Or use the `SENT_BASE_URL` env var base_url="http://my.test.server.example.com:8083", http_client=DefaultHttpxClient( proxy="http://my.test.proxy.example.com", @@ -442,9 +442,9 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. ```py -from sent_dm import SentDm +from sent_dm import Sent -with SentDm() as client: +with Sent() as client: # make requests here ... diff --git a/SECURITY.md b/SECURITY.md index bd37d6c9..e311decf 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,9 +16,9 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Sent Dm, please follow the respective company's security reporting guidelines. +or products provided by Sent, please follow the respective company's security reporting guidelines. -### Sent Dm Terms and Policies +### Sent Terms and Policies Please contact support@sent.dm for any questions or concerns regarding the security of our services. diff --git a/pyproject.toml b/pyproject.toml index e8686e0f..bb5a6c85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [project] name = "sentdm" -version = "0.16.0" -description = "The official Python library for the sent-dm API" +version = "0.17.0" +description = "The official Python library for the Sent API" dynamic = ["readme"] license = "Apache-2.0" authors = [ -{ name = "Sent Dm", email = "support@sent.dm" }, +{ name = "Sent", email = "support@sent.dm" }, ] dependencies = [ diff --git a/src/sent_dm/__init__.py b/src/sent_dm/__init__.py index 5ae911d2..b53eddbb 100644 --- a/src/sent_dm/__init__.py +++ b/src/sent_dm/__init__.py @@ -5,14 +5,14 @@ from . import types from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path -from ._client import Client, SentDm, Stream, Timeout, Transport, AsyncClient, AsyncSentDm, AsyncStream, RequestOptions +from ._client import Sent, Client, Stream, Timeout, AsyncSent, Transport, AsyncClient, AsyncStream, RequestOptions from ._models import BaseModel from ._version import __title__, __version__ from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS from ._exceptions import ( APIError, - SentDmError, + SentError, ConflictError, NotFoundError, APIStatusError, @@ -41,7 +41,7 @@ "not_given", "Omit", "omit", - "SentDmError", + "SentError", "APIError", "APIStatusError", "APITimeoutError", @@ -61,8 +61,8 @@ "AsyncClient", "Stream", "AsyncStream", - "SentDm", - "AsyncSentDm", + "Sent", + "AsyncSent", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", diff --git a/src/sent_dm/_client.py b/src/sent_dm/_client.py index a81386db..03470880 100644 --- a/src/sent_dm/_client.py +++ b/src/sent_dm/_client.py @@ -24,7 +24,7 @@ from ._models import SecurityOptions from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream -from ._exceptions import SentDmError, APIStatusError +from ._exceptions import SentError, APIStatusError from ._base_client import ( DEFAULT_MAX_RETRIES, SyncAPIClient, @@ -42,10 +42,10 @@ from .resources.templates import TemplatesResource, AsyncTemplatesResource from .resources.profiles.profiles import ProfilesResource, AsyncProfilesResource -__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "SentDm", "AsyncSentDm", "Client", "AsyncClient"] +__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Sent", "AsyncSent", "Client", "AsyncClient"] -class SentDm(SyncAPIClient): +class Sent(SyncAPIClient): # client options api_key: str @@ -72,20 +72,20 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous SentDm client instance. + """Construct a new synchronous Sent client instance. This automatically infers the `api_key` argument from the `SENT_DM_API_KEY` environment variable if it is not provided. """ if api_key is None: api_key = os.environ.get("SENT_DM_API_KEY") if api_key is None: - raise SentDmError( + raise SentError( "The api_key client option must be set either by passing api_key to the client or by setting the SENT_DM_API_KEY environment variable" ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("SENT_DM_BASE_URL") + base_url = os.environ.get("SENT_BASE_URL") if base_url is None: base_url = f"https://api.sent.dm" @@ -157,12 +157,12 @@ def me(self) -> MeResource: return MeResource(self) @cached_property - def with_raw_response(self) -> SentDmWithRawResponse: - return SentDmWithRawResponse(self) + def with_raw_response(self) -> SentWithRawResponse: + return SentWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SentDmWithStreamedResponse: - return SentDmWithStreamedResponse(self) + def with_streaming_response(self) -> SentWithStreamedResponse: + return SentWithStreamedResponse(self) @property @override @@ -274,7 +274,7 @@ def _make_status_error( return APIStatusError(err_msg, response=response, body=body) -class AsyncSentDm(AsyncAPIClient): +class AsyncSent(AsyncAPIClient): # client options api_key: str @@ -301,20 +301,20 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async AsyncSentDm client instance. + """Construct a new async AsyncSent client instance. This automatically infers the `api_key` argument from the `SENT_DM_API_KEY` environment variable if it is not provided. """ if api_key is None: api_key = os.environ.get("SENT_DM_API_KEY") if api_key is None: - raise SentDmError( + raise SentError( "The api_key client option must be set either by passing api_key to the client or by setting the SENT_DM_API_KEY environment variable" ) self.api_key = api_key if base_url is None: - base_url = os.environ.get("SENT_DM_BASE_URL") + base_url = os.environ.get("SENT_BASE_URL") if base_url is None: base_url = f"https://api.sent.dm" @@ -386,12 +386,12 @@ def me(self) -> AsyncMeResource: return AsyncMeResource(self) @cached_property - def with_raw_response(self) -> AsyncSentDmWithRawResponse: - return AsyncSentDmWithRawResponse(self) + def with_raw_response(self) -> AsyncSentWithRawResponse: + return AsyncSentWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSentDmWithStreamedResponse: - return AsyncSentDmWithStreamedResponse(self) + def with_streaming_response(self) -> AsyncSentWithStreamedResponse: + return AsyncSentWithStreamedResponse(self) @property @override @@ -503,10 +503,10 @@ def _make_status_error( return APIStatusError(err_msg, response=response, body=body) -class SentDmWithRawResponse: - _client: SentDm +class SentWithRawResponse: + _client: Sent - def __init__(self, client: SentDm) -> None: + def __init__(self, client: Sent) -> None: self._client = client @cached_property @@ -566,10 +566,10 @@ def me(self) -> me.MeResourceWithRawResponse: return MeResourceWithRawResponse(self._client.me) -class AsyncSentDmWithRawResponse: - _client: AsyncSentDm +class AsyncSentWithRawResponse: + _client: AsyncSent - def __init__(self, client: AsyncSentDm) -> None: + def __init__(self, client: AsyncSent) -> None: self._client = client @cached_property @@ -629,10 +629,10 @@ def me(self) -> me.AsyncMeResourceWithRawResponse: return AsyncMeResourceWithRawResponse(self._client.me) -class SentDmWithStreamedResponse: - _client: SentDm +class SentWithStreamedResponse: + _client: Sent - def __init__(self, client: SentDm) -> None: + def __init__(self, client: Sent) -> None: self._client = client @cached_property @@ -692,10 +692,10 @@ def me(self) -> me.MeResourceWithStreamingResponse: return MeResourceWithStreamingResponse(self._client.me) -class AsyncSentDmWithStreamedResponse: - _client: AsyncSentDm +class AsyncSentWithStreamedResponse: + _client: AsyncSent - def __init__(self, client: AsyncSentDm) -> None: + def __init__(self, client: AsyncSent) -> None: self._client = client @cached_property @@ -755,6 +755,6 @@ def me(self) -> me.AsyncMeResourceWithStreamingResponse: return AsyncMeResourceWithStreamingResponse(self._client.me) -Client = SentDm +Client = Sent -AsyncClient = AsyncSentDm +AsyncClient = AsyncSent diff --git a/src/sent_dm/_exceptions.py b/src/sent_dm/_exceptions.py index 9b101c81..d133d2f9 100644 --- a/src/sent_dm/_exceptions.py +++ b/src/sent_dm/_exceptions.py @@ -18,11 +18,11 @@ ] -class SentDmError(Exception): +class SentError(Exception): pass -class APIError(SentDmError): +class APIError(SentError): message: str request: httpx.Request diff --git a/src/sent_dm/_resource.py b/src/sent_dm/_resource.py index 5fcdd790..ff76a75a 100644 --- a/src/sent_dm/_resource.py +++ b/src/sent_dm/_resource.py @@ -8,13 +8,13 @@ import anyio if TYPE_CHECKING: - from ._client import SentDm, AsyncSentDm + from ._client import Sent, AsyncSent class SyncAPIResource: - _client: SentDm + _client: Sent - def __init__(self, client: SentDm) -> None: + def __init__(self, client: Sent) -> None: self._client = client self._get = client.get self._post = client.post @@ -28,9 +28,9 @@ def _sleep(self, seconds: float) -> None: class AsyncAPIResource: - _client: AsyncSentDm + _client: AsyncSent - def __init__(self, client: AsyncSentDm) -> None: + def __init__(self, client: AsyncSent) -> None: self._client = client self._get = client.get self._post = client.post diff --git a/src/sent_dm/_response.py b/src/sent_dm/_response.py index 258adbc1..d6e29d70 100644 --- a/src/sent_dm/_response.py +++ b/src/sent_dm/_response.py @@ -29,7 +29,7 @@ from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type -from ._exceptions import SentDmError, APIResponseValidationError +from ._exceptions import SentError, APIResponseValidationError if TYPE_CHECKING: from ._models import FinalRequestOptions @@ -563,7 +563,7 @@ def __init__(self) -> None: ) -class StreamAlreadyConsumed(SentDmError): +class StreamAlreadyConsumed(SentError): """ Attempted to read or stream content, but the content has already been streamed. diff --git a/src/sent_dm/_streaming.py b/src/sent_dm/_streaming.py index d0aa5727..1310aabb 100644 --- a/src/sent_dm/_streaming.py +++ b/src/sent_dm/_streaming.py @@ -12,7 +12,7 @@ from ._utils import extract_type_var_from_base if TYPE_CHECKING: - from ._client import SentDm, AsyncSentDm + from ._client import Sent, AsyncSent from ._models import FinalRequestOptions @@ -31,7 +31,7 @@ def __init__( *, cast_to: type[_T], response: httpx.Response, - client: SentDm, + client: Sent, options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response @@ -96,7 +96,7 @@ def __init__( *, cast_to: type[_T], response: httpx.Response, - client: AsyncSentDm, + client: AsyncSent, options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response diff --git a/src/sent_dm/_utils/_logs.py b/src/sent_dm/_utils/_logs.py index 54078ade..01f63397 100644 --- a/src/sent_dm/_utils/_logs.py +++ b/src/sent_dm/_utils/_logs.py @@ -14,7 +14,7 @@ def _basic_config() -> None: def setup_logging() -> None: - env = os.environ.get("SENT_DM_LOG") + env = os.environ.get("SENT_LOG") if env == "debug": _basic_config() logger.setLevel(logging.DEBUG) diff --git a/src/sent_dm/_version.py b/src/sent_dm/_version.py index 8e582942..0626f9e2 100644 --- a/src/sent_dm/_version.py +++ b/src/sent_dm/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "sent_dm" -__version__ = "0.16.0" # x-release-please-version +__version__ = "0.17.0" # x-release-please-version diff --git a/tests/api_resources/profiles/test_campaigns.py b/tests/api_resources/profiles/test_campaigns.py index d984e702..535c02c3 100644 --- a/tests/api_resources/profiles/test_campaigns.py +++ b/tests/api_resources/profiles/test_campaigns.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types.profiles import ( CampaignListResponse, @@ -22,7 +22,7 @@ class TestCampaigns: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create(self, client: SentDm) -> None: + def test_method_create(self, client: Sent) -> None: campaign = client.profiles.campaigns.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -44,7 +44,7 @@ def test_method_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create_with_all_params(self, client: SentDm) -> None: + def test_method_create_with_all_params(self, client: Sent) -> None: campaign = client.profiles.campaigns.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -78,7 +78,7 @@ def test_method_create_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_create(self, client: SentDm) -> None: + def test_raw_response_create(self, client: Sent) -> None: response = client.profiles.campaigns.with_raw_response.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -104,7 +104,7 @@ def test_raw_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_create(self, client: SentDm) -> None: + def test_streaming_response_create(self, client: Sent) -> None: with client.profiles.campaigns.with_streaming_response.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -132,7 +132,7 @@ def test_streaming_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_create(self, client: SentDm) -> None: + def test_path_params_create(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.campaigns.with_raw_response.create( profile_id="", @@ -154,7 +154,7 @@ def test_path_params_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update(self, client: SentDm) -> None: + def test_method_update(self, client: Sent) -> None: campaign = client.profiles.campaigns.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -177,7 +177,7 @@ def test_method_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_with_all_params(self, client: SentDm) -> None: + def test_method_update_with_all_params(self, client: Sent) -> None: campaign = client.profiles.campaigns.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -212,7 +212,7 @@ def test_method_update_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update(self, client: SentDm) -> None: + def test_raw_response_update(self, client: Sent) -> None: response = client.profiles.campaigns.with_raw_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -239,7 +239,7 @@ def test_raw_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update(self, client: SentDm) -> None: + def test_streaming_response_update(self, client: Sent) -> None: with client.profiles.campaigns.with_streaming_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -268,7 +268,7 @@ def test_streaming_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update(self, client: SentDm) -> None: + def test_path_params_update(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.campaigns.with_raw_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", @@ -311,7 +311,7 @@ def test_path_params_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: campaign = client.profiles.campaigns.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) @@ -319,7 +319,7 @@ def test_method_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: campaign = client.profiles.campaigns.list( profile_id="770e8400-e29b-41d4-a716-446655440002", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -328,7 +328,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.profiles.campaigns.with_raw_response.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) @@ -340,7 +340,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.profiles.campaigns.with_streaming_response.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) as response: @@ -354,7 +354,7 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_list(self, client: SentDm) -> None: + def test_path_params_list(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.campaigns.with_raw_response.list( profile_id="", @@ -362,7 +362,7 @@ def test_path_params_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete(self, client: SentDm) -> None: + def test_method_delete(self, client: Sent) -> None: campaign = client.profiles.campaigns.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -372,7 +372,7 @@ def test_method_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete_with_all_params(self, client: SentDm) -> None: + def test_method_delete_with_all_params(self, client: Sent) -> None: campaign = client.profiles.campaigns.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -383,7 +383,7 @@ def test_method_delete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_delete(self, client: SentDm) -> None: + def test_raw_response_delete(self, client: Sent) -> None: response = client.profiles.campaigns.with_raw_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -397,7 +397,7 @@ def test_raw_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_delete(self, client: SentDm) -> None: + def test_streaming_response_delete(self, client: Sent) -> None: with client.profiles.campaigns.with_streaming_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -413,7 +413,7 @@ def test_streaming_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_delete(self, client: SentDm) -> None: + def test_path_params_delete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.campaigns.with_raw_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", @@ -436,7 +436,7 @@ class TestAsyncCampaigns: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create(self, async_client: AsyncSentDm) -> None: + async def test_method_create(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -458,7 +458,7 @@ async def test_method_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -492,7 +492,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_create(self, async_client: AsyncSent) -> None: response = await async_client.profiles.campaigns.with_raw_response.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -518,7 +518,7 @@ async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_create(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_create(self, async_client: AsyncSent) -> None: async with async_client.profiles.campaigns.with_streaming_response.create( profile_id="770e8400-e29b-41d4-a716-446655440002", campaign={ @@ -546,7 +546,7 @@ async def test_streaming_response_create(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_create(self, async_client: AsyncSentDm) -> None: + async def test_path_params_create(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.campaigns.with_raw_response.create( profile_id="", @@ -568,7 +568,7 @@ async def test_path_params_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update(self, async_client: AsyncSentDm) -> None: + async def test_method_update(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -591,7 +591,7 @@ async def test_method_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -626,7 +626,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update(self, async_client: AsyncSent) -> None: response = await async_client.profiles.campaigns.with_raw_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -653,7 +653,7 @@ async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update(self, async_client: AsyncSent) -> None: async with async_client.profiles.campaigns.with_streaming_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -682,7 +682,7 @@ async def test_streaming_response_update(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.campaigns.with_raw_response.update( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", @@ -725,7 +725,7 @@ async def test_path_params_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) @@ -733,7 +733,7 @@ async def test_method_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.list( profile_id="770e8400-e29b-41d4-a716-446655440002", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -742,7 +742,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.profiles.campaigns.with_raw_response.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) @@ -754,7 +754,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.profiles.campaigns.with_streaming_response.list( profile_id="770e8400-e29b-41d4-a716-446655440002", ) as response: @@ -768,7 +768,7 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_list(self, async_client: AsyncSentDm) -> None: + async def test_path_params_list(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.campaigns.with_raw_response.list( profile_id="", @@ -776,7 +776,7 @@ async def test_path_params_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete(self, async_client: AsyncSentDm) -> None: + async def test_method_delete(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -786,7 +786,7 @@ async def test_method_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_delete_with_all_params(self, async_client: AsyncSent) -> None: campaign = await async_client.profiles.campaigns.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -797,7 +797,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_delete(self, async_client: AsyncSent) -> None: response = await async_client.profiles.campaigns.with_raw_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -811,7 +811,7 @@ async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_delete(self, async_client: AsyncSent) -> None: async with async_client.profiles.campaigns.with_streaming_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", profile_id="770e8400-e29b-41d4-a716-446655440002", @@ -827,7 +827,7 @@ async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_delete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.campaigns.with_raw_response.delete( campaign_id="b2c3d4e5-f6a7-8901-bcde-f12345678901", diff --git a/tests/api_resources/test_contacts.py b/tests/api_resources/test_contacts.py index e41f336e..f827ce09 100644 --- a/tests/api_resources/test_contacts.py +++ b/tests/api_resources/test_contacts.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( ContactListResponse, @@ -22,13 +22,13 @@ class TestContacts: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create(self, client: SentDm) -> None: + def test_method_create(self, client: Sent) -> None: contact = client.contacts.create() assert_matches_type(APIResponseOfContact, contact, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create_with_all_params(self, client: SentDm) -> None: + def test_method_create_with_all_params(self, client: Sent) -> None: contact = client.contacts.create( phone_number="+1234567890", sandbox=False, @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_create(self, client: SentDm) -> None: + def test_raw_response_create(self, client: Sent) -> None: response = client.contacts.with_raw_response.create() assert response.is_closed is True @@ -49,7 +49,7 @@ def test_raw_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_create(self, client: SentDm) -> None: + def test_streaming_response_create(self, client: Sent) -> None: with client.contacts.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: contact = client.contacts.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -69,7 +69,7 @@ def test_method_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: contact = client.contacts.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -78,7 +78,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.contacts.with_raw_response.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -90,7 +90,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.contacts.with_streaming_response.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -104,7 +104,7 @@ def test_streaming_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve(self, client: SentDm) -> None: + def test_path_params_retrieve(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.contacts.with_raw_response.retrieve( id="", @@ -112,7 +112,7 @@ def test_path_params_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update(self, client: SentDm) -> None: + def test_method_update(self, client: Sent) -> None: contact = client.contacts.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -120,7 +120,7 @@ def test_method_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_with_all_params(self, client: SentDm) -> None: + def test_method_update_with_all_params(self, client: Sent) -> None: contact = client.contacts.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", default_channel="whatsapp", @@ -133,7 +133,7 @@ def test_method_update_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update(self, client: SentDm) -> None: + def test_raw_response_update(self, client: Sent) -> None: response = client.contacts.with_raw_response.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -145,7 +145,7 @@ def test_raw_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update(self, client: SentDm) -> None: + def test_streaming_response_update(self, client: Sent) -> None: with client.contacts.with_streaming_response.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -159,7 +159,7 @@ def test_streaming_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update(self, client: SentDm) -> None: + def test_path_params_update(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.contacts.with_raw_response.update( id="", @@ -167,7 +167,7 @@ def test_path_params_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: contact = client.contacts.list( page=0, page_size=0, @@ -176,7 +176,7 @@ def test_method_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: contact = client.contacts.list( page=0, page_size=0, @@ -189,7 +189,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.contacts.with_raw_response.list( page=0, page_size=0, @@ -202,7 +202,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.contacts.with_streaming_response.list( page=0, page_size=0, @@ -217,7 +217,7 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete(self, client: SentDm) -> None: + def test_method_delete(self, client: Sent) -> None: contact = client.contacts.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -226,7 +226,7 @@ def test_method_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete_with_all_params(self, client: SentDm) -> None: + def test_method_delete_with_all_params(self, client: Sent) -> None: contact = client.contacts.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={"sandbox": False}, @@ -236,7 +236,7 @@ def test_method_delete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_delete(self, client: SentDm) -> None: + def test_raw_response_delete(self, client: Sent) -> None: response = client.contacts.with_raw_response.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -249,7 +249,7 @@ def test_raw_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_delete(self, client: SentDm) -> None: + def test_streaming_response_delete(self, client: Sent) -> None: with client.contacts.with_streaming_response.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -264,7 +264,7 @@ def test_streaming_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_delete(self, client: SentDm) -> None: + def test_path_params_delete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.contacts.with_raw_response.delete( id="", @@ -279,13 +279,13 @@ class TestAsyncContacts: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create(self, async_client: AsyncSentDm) -> None: + async def test_method_create(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.create() assert_matches_type(APIResponseOfContact, contact, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.create( phone_number="+1234567890", sandbox=False, @@ -296,7 +296,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_create(self, async_client: AsyncSent) -> None: response = await async_client.contacts.with_raw_response.create() assert response.is_closed is True @@ -306,7 +306,7 @@ async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_create(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_create(self, async_client: AsyncSent) -> None: async with async_client.contacts.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -318,7 +318,7 @@ async def test_streaming_response_create(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -326,7 +326,7 @@ async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -335,7 +335,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.contacts.with_raw_response.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -347,7 +347,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.contacts.with_streaming_response.retrieve( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -361,7 +361,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.contacts.with_raw_response.retrieve( id="", @@ -369,7 +369,7 @@ async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update(self, async_client: AsyncSentDm) -> None: + async def test_method_update(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -377,7 +377,7 @@ async def test_method_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", default_channel="whatsapp", @@ -390,7 +390,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update(self, async_client: AsyncSent) -> None: response = await async_client.contacts.with_raw_response.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) @@ -402,7 +402,7 @@ async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update(self, async_client: AsyncSent) -> None: async with async_client.contacts.with_streaming_response.update( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -416,7 +416,7 @@ async def test_streaming_response_update(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.contacts.with_raw_response.update( id="", @@ -424,7 +424,7 @@ async def test_path_params_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.list( page=0, page_size=0, @@ -433,7 +433,7 @@ async def test_method_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.list( page=0, page_size=0, @@ -446,7 +446,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.contacts.with_raw_response.list( page=0, page_size=0, @@ -459,7 +459,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.contacts.with_streaming_response.list( page=0, page_size=0, @@ -474,7 +474,7 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete(self, async_client: AsyncSentDm) -> None: + async def test_method_delete(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -483,7 +483,7 @@ async def test_method_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_delete_with_all_params(self, async_client: AsyncSent) -> None: contact = await async_client.contacts.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={"sandbox": False}, @@ -493,7 +493,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_delete(self, async_client: AsyncSent) -> None: response = await async_client.contacts.with_raw_response.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -506,7 +506,7 @@ async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_delete(self, async_client: AsyncSent) -> None: async with async_client.contacts.with_streaming_response.delete( id="6ba7b810-9dad-11d1-80b4-00c04fd430c8", body={}, @@ -521,7 +521,7 @@ async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_delete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.contacts.with_raw_response.delete( id="", diff --git a/tests/api_resources/test_me.py b/tests/api_resources/test_me.py index 8d4be8f8..5647b663 100644 --- a/tests/api_resources/test_me.py +++ b/tests/api_resources/test_me.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import MeRetrieveResponse @@ -19,13 +19,13 @@ class TestMe: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: me = client.me.retrieve() assert_matches_type(MeRetrieveResponse, me, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: me = client.me.retrieve( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -33,7 +33,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.me.with_raw_response.retrieve() assert response.is_closed is True @@ -43,7 +43,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.me.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,13 +61,13 @@ class TestAsyncMe: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: me = await async_client.me.retrieve() assert_matches_type(MeRetrieveResponse, me, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: me = await async_client.me.retrieve( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -75,7 +75,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.me.with_raw_response.retrieve() assert response.is_closed is True @@ -85,7 +85,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.me.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_messages.py b/tests/api_resources/test_messages.py index 1b3bf6fb..3180dbd5 100644 --- a/tests/api_resources/test_messages.py +++ b/tests/api_resources/test_messages.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( MessageSendResponse, @@ -23,7 +23,7 @@ class TestMessages: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_activities(self, client: SentDm) -> None: + def test_method_retrieve_activities(self, client: Sent) -> None: message = client.messages.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -31,7 +31,7 @@ def test_method_retrieve_activities(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_activities_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_activities_with_all_params(self, client: Sent) -> None: message = client.messages.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -40,7 +40,7 @@ def test_method_retrieve_activities_with_all_params(self, client: SentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve_activities(self, client: SentDm) -> None: + def test_raw_response_retrieve_activities(self, client: Sent) -> None: response = client.messages.with_raw_response.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -52,7 +52,7 @@ def test_raw_response_retrieve_activities(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve_activities(self, client: SentDm) -> None: + def test_streaming_response_retrieve_activities(self, client: Sent) -> None: with client.messages.with_streaming_response.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -66,7 +66,7 @@ def test_streaming_response_retrieve_activities(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve_activities(self, client: SentDm) -> None: + def test_path_params_retrieve_activities(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.messages.with_raw_response.retrieve_activities( id="", @@ -74,7 +74,7 @@ def test_path_params_retrieve_activities(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_status(self, client: SentDm) -> None: + def test_method_retrieve_status(self, client: Sent) -> None: message = client.messages.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -82,7 +82,7 @@ def test_method_retrieve_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_status_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_status_with_all_params(self, client: Sent) -> None: message = client.messages.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -91,7 +91,7 @@ def test_method_retrieve_status_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve_status(self, client: SentDm) -> None: + def test_raw_response_retrieve_status(self, client: Sent) -> None: response = client.messages.with_raw_response.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -103,7 +103,7 @@ def test_raw_response_retrieve_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve_status(self, client: SentDm) -> None: + def test_streaming_response_retrieve_status(self, client: Sent) -> None: with client.messages.with_streaming_response.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -117,7 +117,7 @@ def test_streaming_response_retrieve_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve_status(self, client: SentDm) -> None: + def test_path_params_retrieve_status(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.messages.with_raw_response.retrieve_status( id="", @@ -125,13 +125,13 @@ def test_path_params_retrieve_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_send(self, client: SentDm) -> None: + def test_method_send(self, client: Sent) -> None: message = client.messages.send() assert_matches_type(MessageSendResponse, message, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_send_with_all_params(self, client: SentDm) -> None: + def test_method_send_with_all_params(self, client: Sent) -> None: message = client.messages.send( channel=["sms", "whatsapp"], sandbox=False, @@ -151,7 +151,7 @@ def test_method_send_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_send(self, client: SentDm) -> None: + def test_raw_response_send(self, client: Sent) -> None: response = client.messages.with_raw_response.send() assert response.is_closed is True @@ -161,7 +161,7 @@ def test_raw_response_send(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_send(self, client: SentDm) -> None: + def test_streaming_response_send(self, client: Sent) -> None: with client.messages.with_streaming_response.send() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,7 +179,7 @@ class TestAsyncMessages: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_activities(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_activities(self, async_client: AsyncSent) -> None: message = await async_client.messages.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -187,7 +187,7 @@ async def test_method_retrieve_activities(self, async_client: AsyncSentDm) -> No @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_activities_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_activities_with_all_params(self, async_client: AsyncSent) -> None: message = await async_client.messages.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -196,7 +196,7 @@ async def test_method_retrieve_activities_with_all_params(self, async_client: As @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve_activities(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve_activities(self, async_client: AsyncSent) -> None: response = await async_client.messages.with_raw_response.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -208,7 +208,7 @@ async def test_raw_response_retrieve_activities(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve_activities(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve_activities(self, async_client: AsyncSent) -> None: async with async_client.messages.with_streaming_response.retrieve_activities( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -222,7 +222,7 @@ async def test_streaming_response_retrieve_activities(self, async_client: AsyncS @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve_activities(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve_activities(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.messages.with_raw_response.retrieve_activities( id="", @@ -230,7 +230,7 @@ async def test_path_params_retrieve_activities(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_status(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_status(self, async_client: AsyncSent) -> None: message = await async_client.messages.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -238,7 +238,7 @@ async def test_method_retrieve_status(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_status_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_status_with_all_params(self, async_client: AsyncSent) -> None: message = await async_client.messages.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -247,7 +247,7 @@ async def test_method_retrieve_status_with_all_params(self, async_client: AsyncS @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve_status(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve_status(self, async_client: AsyncSent) -> None: response = await async_client.messages.with_raw_response.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) @@ -259,7 +259,7 @@ async def test_raw_response_retrieve_status(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve_status(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve_status(self, async_client: AsyncSent) -> None: async with async_client.messages.with_streaming_response.retrieve_status( id="8ba7b830-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -273,7 +273,7 @@ async def test_streaming_response_retrieve_status(self, async_client: AsyncSentD @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve_status(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve_status(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.messages.with_raw_response.retrieve_status( id="", @@ -281,13 +281,13 @@ async def test_path_params_retrieve_status(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_send(self, async_client: AsyncSentDm) -> None: + async def test_method_send(self, async_client: AsyncSent) -> None: message = await async_client.messages.send() assert_matches_type(MessageSendResponse, message, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_send_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_send_with_all_params(self, async_client: AsyncSent) -> None: message = await async_client.messages.send( channel=["sms", "whatsapp"], sandbox=False, @@ -307,7 +307,7 @@ async def test_method_send_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_send(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_send(self, async_client: AsyncSent) -> None: response = await async_client.messages.with_raw_response.send() assert response.is_closed is True @@ -317,7 +317,7 @@ async def test_raw_response_send(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_send(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_send(self, async_client: AsyncSent) -> None: async with async_client.messages.with_streaming_response.send() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_numbers.py b/tests/api_resources/test_numbers.py index 94902748..c6d1ffa0 100644 --- a/tests/api_resources/test_numbers.py +++ b/tests/api_resources/test_numbers.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import NumberLookupResponse @@ -19,7 +19,7 @@ class TestNumbers: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_lookup(self, client: SentDm) -> None: + def test_method_lookup(self, client: Sent) -> None: number = client.numbers.lookup( phone_number="+12025551234", ) @@ -27,7 +27,7 @@ def test_method_lookup(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_lookup_with_all_params(self, client: SentDm) -> None: + def test_method_lookup_with_all_params(self, client: Sent) -> None: number = client.numbers.lookup( phone_number="+12025551234", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -36,7 +36,7 @@ def test_method_lookup_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_lookup(self, client: SentDm) -> None: + def test_raw_response_lookup(self, client: Sent) -> None: response = client.numbers.with_raw_response.lookup( phone_number="+12025551234", ) @@ -48,7 +48,7 @@ def test_raw_response_lookup(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_lookup(self, client: SentDm) -> None: + def test_streaming_response_lookup(self, client: Sent) -> None: with client.numbers.with_streaming_response.lookup( phone_number="+12025551234", ) as response: @@ -62,7 +62,7 @@ def test_streaming_response_lookup(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_lookup(self, client: SentDm) -> None: + def test_path_params_lookup(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): client.numbers.with_raw_response.lookup( phone_number="", @@ -76,7 +76,7 @@ class TestAsyncNumbers: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_lookup(self, async_client: AsyncSentDm) -> None: + async def test_method_lookup(self, async_client: AsyncSent) -> None: number = await async_client.numbers.lookup( phone_number="+12025551234", ) @@ -84,7 +84,7 @@ async def test_method_lookup(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_lookup_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_lookup_with_all_params(self, async_client: AsyncSent) -> None: number = await async_client.numbers.lookup( phone_number="+12025551234", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -93,7 +93,7 @@ async def test_method_lookup_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_lookup(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_lookup(self, async_client: AsyncSent) -> None: response = await async_client.numbers.with_raw_response.lookup( phone_number="+12025551234", ) @@ -105,7 +105,7 @@ async def test_raw_response_lookup(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_lookup(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_lookup(self, async_client: AsyncSent) -> None: async with async_client.numbers.with_streaming_response.lookup( phone_number="+12025551234", ) as response: @@ -119,7 +119,7 @@ async def test_streaming_response_lookup(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_lookup(self, async_client: AsyncSentDm) -> None: + async def test_path_params_lookup(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `phone_number` but received ''"): await async_client.numbers.with_raw_response.lookup( phone_number="", diff --git a/tests/api_resources/test_profiles.py b/tests/api_resources/test_profiles.py index b6707f78..416b2398 100644 --- a/tests/api_resources/test_profiles.py +++ b/tests/api_resources/test_profiles.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( ProfileListResponse, @@ -22,13 +22,13 @@ class TestProfiles: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create(self, client: SentDm) -> None: + def test_method_create(self, client: Sent) -> None: profile = client.profiles.create() assert_matches_type(APIResponseOfProfileDetail, profile, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create_with_all_params(self, client: SentDm) -> None: + def test_method_create_with_all_params(self, client: Sent) -> None: profile = client.profiles.create( allow_contact_sharing=True, allow_template_sharing=False, @@ -104,7 +104,7 @@ def test_method_create_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_create(self, client: SentDm) -> None: + def test_raw_response_create(self, client: Sent) -> None: response = client.profiles.with_raw_response.create() assert response.is_closed is True @@ -114,7 +114,7 @@ def test_raw_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_create(self, client: SentDm) -> None: + def test_streaming_response_create(self, client: Sent) -> None: with client.profiles.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,7 +126,7 @@ def test_streaming_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: profile = client.profiles.retrieve( profile_id="profileId", ) @@ -134,7 +134,7 @@ def test_method_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: profile = client.profiles.retrieve( profile_id="profileId", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -143,7 +143,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.profiles.with_raw_response.retrieve( profile_id="profileId", ) @@ -155,7 +155,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.profiles.with_streaming_response.retrieve( profile_id="profileId", ) as response: @@ -169,7 +169,7 @@ def test_streaming_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve(self, client: SentDm) -> None: + def test_path_params_retrieve(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.with_raw_response.retrieve( profile_id="", @@ -177,7 +177,7 @@ def test_path_params_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update(self, client: SentDm) -> None: + def test_method_update(self, client: Sent) -> None: profile = client.profiles.update( profile_id="profileId", ) @@ -185,7 +185,7 @@ def test_method_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_with_all_params(self, client: SentDm) -> None: + def test_method_update_with_all_params(self, client: Sent) -> None: profile = client.profiles.update( profile_id="profileId", allow_contact_sharing=True, @@ -262,7 +262,7 @@ def test_method_update_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update(self, client: SentDm) -> None: + def test_raw_response_update(self, client: Sent) -> None: response = client.profiles.with_raw_response.update( profile_id="profileId", ) @@ -274,7 +274,7 @@ def test_raw_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update(self, client: SentDm) -> None: + def test_streaming_response_update(self, client: Sent) -> None: with client.profiles.with_streaming_response.update( profile_id="profileId", ) as response: @@ -288,7 +288,7 @@ def test_streaming_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update(self, client: SentDm) -> None: + def test_path_params_update(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.with_raw_response.update( profile_id="", @@ -296,13 +296,13 @@ def test_path_params_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: profile = client.profiles.list() assert_matches_type(ProfileListResponse, profile, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: profile = client.profiles.list( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -310,7 +310,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.profiles.with_raw_response.list() assert response.is_closed is True @@ -320,7 +320,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.profiles.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -332,7 +332,7 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete(self, client: SentDm) -> None: + def test_method_delete(self, client: Sent) -> None: profile = client.profiles.delete( profile_id="profileId", body={}, @@ -341,7 +341,7 @@ def test_method_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete_with_all_params(self, client: SentDm) -> None: + def test_method_delete_with_all_params(self, client: Sent) -> None: profile = client.profiles.delete( profile_id="profileId", body={"sandbox": False}, @@ -351,7 +351,7 @@ def test_method_delete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_delete(self, client: SentDm) -> None: + def test_raw_response_delete(self, client: Sent) -> None: response = client.profiles.with_raw_response.delete( profile_id="profileId", body={}, @@ -364,7 +364,7 @@ def test_raw_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_delete(self, client: SentDm) -> None: + def test_streaming_response_delete(self, client: Sent) -> None: with client.profiles.with_streaming_response.delete( profile_id="profileId", body={}, @@ -379,7 +379,7 @@ def test_streaming_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_delete(self, client: SentDm) -> None: + def test_path_params_delete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.with_raw_response.delete( profile_id="", @@ -388,7 +388,7 @@ def test_path_params_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_complete(self, client: SentDm) -> None: + def test_method_complete(self, client: Sent) -> None: profile = client.profiles.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -397,7 +397,7 @@ def test_method_complete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_complete_with_all_params(self, client: SentDm) -> None: + def test_method_complete_with_all_params(self, client: Sent) -> None: profile = client.profiles.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -409,7 +409,7 @@ def test_method_complete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_complete(self, client: SentDm) -> None: + def test_raw_response_complete(self, client: Sent) -> None: response = client.profiles.with_raw_response.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -422,7 +422,7 @@ def test_raw_response_complete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_complete(self, client: SentDm) -> None: + def test_streaming_response_complete(self, client: Sent) -> None: with client.profiles.with_streaming_response.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -437,7 +437,7 @@ def test_streaming_response_complete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_complete(self, client: SentDm) -> None: + def test_path_params_complete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): client.profiles.with_raw_response.complete( profile_id="", @@ -452,13 +452,13 @@ class TestAsyncProfiles: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create(self, async_client: AsyncSentDm) -> None: + async def test_method_create(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.create() assert_matches_type(APIResponseOfProfileDetail, profile, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.create( allow_contact_sharing=True, allow_template_sharing=False, @@ -534,7 +534,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_create(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.create() assert response.is_closed is True @@ -544,7 +544,7 @@ async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_create(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_create(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -556,7 +556,7 @@ async def test_streaming_response_create(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.retrieve( profile_id="profileId", ) @@ -564,7 +564,7 @@ async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.retrieve( profile_id="profileId", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -573,7 +573,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.retrieve( profile_id="profileId", ) @@ -585,7 +585,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.retrieve( profile_id="profileId", ) as response: @@ -599,7 +599,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.with_raw_response.retrieve( profile_id="", @@ -607,7 +607,7 @@ async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update(self, async_client: AsyncSentDm) -> None: + async def test_method_update(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.update( profile_id="profileId", ) @@ -615,7 +615,7 @@ async def test_method_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.update( profile_id="profileId", allow_contact_sharing=True, @@ -692,7 +692,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.update( profile_id="profileId", ) @@ -704,7 +704,7 @@ async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.update( profile_id="profileId", ) as response: @@ -718,7 +718,7 @@ async def test_streaming_response_update(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.with_raw_response.update( profile_id="", @@ -726,13 +726,13 @@ async def test_path_params_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.list() assert_matches_type(ProfileListResponse, profile, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.list( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -740,7 +740,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.list() assert response.is_closed is True @@ -750,7 +750,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -762,7 +762,7 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete(self, async_client: AsyncSentDm) -> None: + async def test_method_delete(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.delete( profile_id="profileId", body={}, @@ -771,7 +771,7 @@ async def test_method_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_delete_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.delete( profile_id="profileId", body={"sandbox": False}, @@ -781,7 +781,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_delete(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.delete( profile_id="profileId", body={}, @@ -794,7 +794,7 @@ async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_delete(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.delete( profile_id="profileId", body={}, @@ -809,7 +809,7 @@ async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_delete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.with_raw_response.delete( profile_id="", @@ -818,7 +818,7 @@ async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_complete(self, async_client: AsyncSentDm) -> None: + async def test_method_complete(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -827,7 +827,7 @@ async def test_method_complete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_complete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_complete_with_all_params(self, async_client: AsyncSent) -> None: profile = await async_client.profiles.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -839,7 +839,7 @@ async def test_method_complete_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_complete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_complete(self, async_client: AsyncSent) -> None: response = await async_client.profiles.with_raw_response.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -852,7 +852,7 @@ async def test_raw_response_complete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_complete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_complete(self, async_client: AsyncSent) -> None: async with async_client.profiles.with_streaming_response.complete( profile_id="660e8400-e29b-41d4-a716-446655440000", web_hook_url="https://your-app.com/webhook/profile-complete", @@ -867,7 +867,7 @@ async def test_streaming_response_complete(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_complete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_complete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `profile_id` but received ''"): await async_client.profiles.with_raw_response.complete( profile_id="", diff --git a/tests/api_resources/test_templates.py b/tests/api_resources/test_templates.py index 5bba5c55..44cc1dd9 100644 --- a/tests/api_resources/test_templates.py +++ b/tests/api_resources/test_templates.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( APIResponseTemplate, @@ -22,13 +22,13 @@ class TestTemplates: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create(self, client: SentDm) -> None: + def test_method_create(self, client: Sent) -> None: template = client.templates.create() assert_matches_type(APIResponseTemplate, template, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create_with_all_params(self, client: SentDm) -> None: + def test_method_create_with_all_params(self, client: Sent) -> None: template = client.templates.create( category="MARKETING", creation_source=None, @@ -185,7 +185,7 @@ def test_method_create_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_create(self, client: SentDm) -> None: + def test_raw_response_create(self, client: Sent) -> None: response = client.templates.with_raw_response.create() assert response.is_closed is True @@ -195,7 +195,7 @@ def test_raw_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_create(self, client: SentDm) -> None: + def test_streaming_response_create(self, client: Sent) -> None: with client.templates.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -207,7 +207,7 @@ def test_streaming_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: template = client.templates.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -215,7 +215,7 @@ def test_method_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: template = client.templates.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -224,7 +224,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.templates.with_raw_response.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -236,7 +236,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.templates.with_streaming_response.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -250,7 +250,7 @@ def test_streaming_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve(self, client: SentDm) -> None: + def test_path_params_retrieve(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.templates.with_raw_response.retrieve( id="", @@ -258,7 +258,7 @@ def test_path_params_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update(self, client: SentDm) -> None: + def test_method_update(self, client: Sent) -> None: template = client.templates.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -266,7 +266,7 @@ def test_method_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_with_all_params(self, client: SentDm) -> None: + def test_method_update_with_all_params(self, client: Sent) -> None: template = client.templates.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", category="MARKETING", @@ -410,7 +410,7 @@ def test_method_update_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update(self, client: SentDm) -> None: + def test_raw_response_update(self, client: Sent) -> None: response = client.templates.with_raw_response.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -422,7 +422,7 @@ def test_raw_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update(self, client: SentDm) -> None: + def test_streaming_response_update(self, client: Sent) -> None: with client.templates.with_streaming_response.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -436,7 +436,7 @@ def test_streaming_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update(self, client: SentDm) -> None: + def test_path_params_update(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.templates.with_raw_response.update( id="", @@ -444,7 +444,7 @@ def test_path_params_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: template = client.templates.list( page=0, page_size=0, @@ -453,7 +453,7 @@ def test_method_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: template = client.templates.list( page=0, page_size=0, @@ -467,7 +467,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.templates.with_raw_response.list( page=0, page_size=0, @@ -480,7 +480,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.templates.with_streaming_response.list( page=0, page_size=0, @@ -495,7 +495,7 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete(self, client: SentDm) -> None: + def test_method_delete(self, client: Sent) -> None: template = client.templates.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -503,7 +503,7 @@ def test_method_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete_with_all_params(self, client: SentDm) -> None: + def test_method_delete_with_all_params(self, client: Sent) -> None: template = client.templates.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", delete_from_meta=False, @@ -514,7 +514,7 @@ def test_method_delete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_delete(self, client: SentDm) -> None: + def test_raw_response_delete(self, client: Sent) -> None: response = client.templates.with_raw_response.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -526,7 +526,7 @@ def test_raw_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_delete(self, client: SentDm) -> None: + def test_streaming_response_delete(self, client: Sent) -> None: with client.templates.with_streaming_response.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -540,7 +540,7 @@ def test_streaming_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_delete(self, client: SentDm) -> None: + def test_path_params_delete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.templates.with_raw_response.delete( id="", @@ -554,13 +554,13 @@ class TestAsyncTemplates: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create(self, async_client: AsyncSentDm) -> None: + async def test_method_create(self, async_client: AsyncSent) -> None: template = await async_client.templates.create() assert_matches_type(APIResponseTemplate, template, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncSent) -> None: template = await async_client.templates.create( category="MARKETING", creation_source=None, @@ -717,7 +717,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_create(self, async_client: AsyncSent) -> None: response = await async_client.templates.with_raw_response.create() assert response.is_closed is True @@ -727,7 +727,7 @@ async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_create(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_create(self, async_client: AsyncSent) -> None: async with async_client.templates.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -739,7 +739,7 @@ async def test_streaming_response_create(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: template = await async_client.templates.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -747,7 +747,7 @@ async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: template = await async_client.templates.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -756,7 +756,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.templates.with_raw_response.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -768,7 +768,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.templates.with_streaming_response.retrieve( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -782,7 +782,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.templates.with_raw_response.retrieve( id="", @@ -790,7 +790,7 @@ async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update(self, async_client: AsyncSentDm) -> None: + async def test_method_update(self, async_client: AsyncSent) -> None: template = await async_client.templates.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -798,7 +798,7 @@ async def test_method_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncSent) -> None: template = await async_client.templates.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", category="MARKETING", @@ -942,7 +942,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update(self, async_client: AsyncSent) -> None: response = await async_client.templates.with_raw_response.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -954,7 +954,7 @@ async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update(self, async_client: AsyncSent) -> None: async with async_client.templates.with_streaming_response.update( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -968,7 +968,7 @@ async def test_streaming_response_update(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.templates.with_raw_response.update( id="", @@ -976,7 +976,7 @@ async def test_path_params_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: template = await async_client.templates.list( page=0, page_size=0, @@ -985,7 +985,7 @@ async def test_method_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: template = await async_client.templates.list( page=0, page_size=0, @@ -999,7 +999,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.templates.with_raw_response.list( page=0, page_size=0, @@ -1012,7 +1012,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.templates.with_streaming_response.list( page=0, page_size=0, @@ -1027,7 +1027,7 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete(self, async_client: AsyncSentDm) -> None: + async def test_method_delete(self, async_client: AsyncSent) -> None: template = await async_client.templates.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -1035,7 +1035,7 @@ async def test_method_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_delete_with_all_params(self, async_client: AsyncSent) -> None: template = await async_client.templates.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", delete_from_meta=False, @@ -1046,7 +1046,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_delete(self, async_client: AsyncSent) -> None: response = await async_client.templates.with_raw_response.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) @@ -1058,7 +1058,7 @@ async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_delete(self, async_client: AsyncSent) -> None: async with async_client.templates.with_streaming_response.delete( id="7ba7b820-9dad-11d1-80b4-00c04fd430c8", ) as response: @@ -1072,7 +1072,7 @@ async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_delete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.templates.with_raw_response.delete( id="", diff --git a/tests/api_resources/test_users.py b/tests/api_resources/test_users.py index ba602a78..099c37d6 100644 --- a/tests/api_resources/test_users.py +++ b/tests/api_resources/test_users.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( UserListResponse, @@ -22,7 +22,7 @@ class TestUsers: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: user = client.users.retrieve( user_id="userId", ) @@ -30,7 +30,7 @@ def test_method_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: user = client.users.retrieve( user_id="userId", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -39,7 +39,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.users.with_raw_response.retrieve( user_id="userId", ) @@ -51,7 +51,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.users.with_streaming_response.retrieve( user_id="userId", ) as response: @@ -65,7 +65,7 @@ def test_streaming_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve(self, client: SentDm) -> None: + def test_path_params_retrieve(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): client.users.with_raw_response.retrieve( user_id="", @@ -73,13 +73,13 @@ def test_path_params_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: user = client.users.list() assert_matches_type(UserListResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: user = client.users.list( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -87,7 +87,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.users.with_raw_response.list() assert response.is_closed is True @@ -97,7 +97,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.users.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -109,13 +109,13 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_invite(self, client: SentDm) -> None: + def test_method_invite(self, client: Sent) -> None: user = client.users.invite() assert_matches_type(APIResponseOfUser, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_invite_with_all_params(self, client: SentDm) -> None: + def test_method_invite_with_all_params(self, client: Sent) -> None: user = client.users.invite( email="newuser@example.com", name="New User", @@ -128,7 +128,7 @@ def test_method_invite_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_invite(self, client: SentDm) -> None: + def test_raw_response_invite(self, client: Sent) -> None: response = client.users.with_raw_response.invite() assert response.is_closed is True @@ -138,7 +138,7 @@ def test_raw_response_invite(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_invite(self, client: SentDm) -> None: + def test_streaming_response_invite(self, client: Sent) -> None: with client.users.with_streaming_response.invite() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,7 +150,7 @@ def test_streaming_response_invite(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_remove(self, client: SentDm) -> None: + def test_method_remove(self, client: Sent) -> None: user = client.users.remove( user_id="userId", body={}, @@ -159,7 +159,7 @@ def test_method_remove(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_remove_with_all_params(self, client: SentDm) -> None: + def test_method_remove_with_all_params(self, client: Sent) -> None: user = client.users.remove( user_id="userId", body={"sandbox": False}, @@ -169,7 +169,7 @@ def test_method_remove_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_remove(self, client: SentDm) -> None: + def test_raw_response_remove(self, client: Sent) -> None: response = client.users.with_raw_response.remove( user_id="userId", body={}, @@ -182,7 +182,7 @@ def test_raw_response_remove(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_remove(self, client: SentDm) -> None: + def test_streaming_response_remove(self, client: Sent) -> None: with client.users.with_streaming_response.remove( user_id="userId", body={}, @@ -197,7 +197,7 @@ def test_streaming_response_remove(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_remove(self, client: SentDm) -> None: + def test_path_params_remove(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): client.users.with_raw_response.remove( user_id="", @@ -206,7 +206,7 @@ def test_path_params_remove(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_role(self, client: SentDm) -> None: + def test_method_update_role(self, client: Sent) -> None: user = client.users.update_role( user_id="userId", ) @@ -214,7 +214,7 @@ def test_method_update_role(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_role_with_all_params(self, client: SentDm) -> None: + def test_method_update_role_with_all_params(self, client: Sent) -> None: user = client.users.update_role( user_id="userId", role="billing", @@ -226,7 +226,7 @@ def test_method_update_role_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update_role(self, client: SentDm) -> None: + def test_raw_response_update_role(self, client: Sent) -> None: response = client.users.with_raw_response.update_role( user_id="userId", ) @@ -238,7 +238,7 @@ def test_raw_response_update_role(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update_role(self, client: SentDm) -> None: + def test_streaming_response_update_role(self, client: Sent) -> None: with client.users.with_streaming_response.update_role( user_id="userId", ) as response: @@ -252,7 +252,7 @@ def test_streaming_response_update_role(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update_role(self, client: SentDm) -> None: + def test_path_params_update_role(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): client.users.with_raw_response.update_role( user_id="", @@ -266,7 +266,7 @@ class TestAsyncUsers: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: user = await async_client.users.retrieve( user_id="userId", ) @@ -274,7 +274,7 @@ async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: user = await async_client.users.retrieve( user_id="userId", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -283,7 +283,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.users.with_raw_response.retrieve( user_id="userId", ) @@ -295,7 +295,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.users.with_streaming_response.retrieve( user_id="userId", ) as response: @@ -309,7 +309,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): await async_client.users.with_raw_response.retrieve( user_id="", @@ -317,13 +317,13 @@ async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: user = await async_client.users.list() assert_matches_type(UserListResponse, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: user = await async_client.users.list( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -331,7 +331,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.users.with_raw_response.list() assert response.is_closed is True @@ -341,7 +341,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.users.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -353,13 +353,13 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_invite(self, async_client: AsyncSentDm) -> None: + async def test_method_invite(self, async_client: AsyncSent) -> None: user = await async_client.users.invite() assert_matches_type(APIResponseOfUser, user, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_invite_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_invite_with_all_params(self, async_client: AsyncSent) -> None: user = await async_client.users.invite( email="newuser@example.com", name="New User", @@ -372,7 +372,7 @@ async def test_method_invite_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_invite(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_invite(self, async_client: AsyncSent) -> None: response = await async_client.users.with_raw_response.invite() assert response.is_closed is True @@ -382,7 +382,7 @@ async def test_raw_response_invite(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_invite(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_invite(self, async_client: AsyncSent) -> None: async with async_client.users.with_streaming_response.invite() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -394,7 +394,7 @@ async def test_streaming_response_invite(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_remove(self, async_client: AsyncSentDm) -> None: + async def test_method_remove(self, async_client: AsyncSent) -> None: user = await async_client.users.remove( user_id="userId", body={}, @@ -403,7 +403,7 @@ async def test_method_remove(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_remove_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_remove_with_all_params(self, async_client: AsyncSent) -> None: user = await async_client.users.remove( user_id="userId", body={"sandbox": False}, @@ -413,7 +413,7 @@ async def test_method_remove_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_remove(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_remove(self, async_client: AsyncSent) -> None: response = await async_client.users.with_raw_response.remove( user_id="userId", body={}, @@ -426,7 +426,7 @@ async def test_raw_response_remove(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_remove(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_remove(self, async_client: AsyncSent) -> None: async with async_client.users.with_streaming_response.remove( user_id="userId", body={}, @@ -441,7 +441,7 @@ async def test_streaming_response_remove(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_remove(self, async_client: AsyncSentDm) -> None: + async def test_path_params_remove(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): await async_client.users.with_raw_response.remove( user_id="", @@ -450,7 +450,7 @@ async def test_path_params_remove(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_role(self, async_client: AsyncSentDm) -> None: + async def test_method_update_role(self, async_client: AsyncSent) -> None: user = await async_client.users.update_role( user_id="userId", ) @@ -458,7 +458,7 @@ async def test_method_update_role(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_role_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_role_with_all_params(self, async_client: AsyncSent) -> None: user = await async_client.users.update_role( user_id="userId", role="billing", @@ -470,7 +470,7 @@ async def test_method_update_role_with_all_params(self, async_client: AsyncSentD @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update_role(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update_role(self, async_client: AsyncSent) -> None: response = await async_client.users.with_raw_response.update_role( user_id="userId", ) @@ -482,7 +482,7 @@ async def test_raw_response_update_role(self, async_client: AsyncSentDm) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update_role(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update_role(self, async_client: AsyncSent) -> None: async with async_client.users.with_streaming_response.update_role( user_id="userId", ) as response: @@ -496,7 +496,7 @@ async def test_streaming_response_update_role(self, async_client: AsyncSentDm) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update_role(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update_role(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): await async_client.users.with_raw_response.update_role( user_id="", diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py index a6c8edd2..8cec62ea 100644 --- a/tests/api_resources/test_webhooks.py +++ b/tests/api_resources/test_webhooks.py @@ -7,7 +7,7 @@ import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from tests.utils import assert_matches_type from sent_dm.types import ( APIResponseWebhook, @@ -26,13 +26,13 @@ class TestWebhooks: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create(self, client: SentDm) -> None: + def test_method_create(self, client: Sent) -> None: webhook = client.webhooks.create() assert_matches_type(APIResponseWebhook, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_create_with_all_params(self, client: SentDm) -> None: + def test_method_create_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.create( display_name="Order Notifications", endpoint_url="https://example.com/webhooks/orders", @@ -47,7 +47,7 @@ def test_method_create_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_create(self, client: SentDm) -> None: + def test_raw_response_create(self, client: Sent) -> None: response = client.webhooks.with_raw_response.create() assert response.is_closed is True @@ -57,7 +57,7 @@ def test_raw_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_create(self, client: SentDm) -> None: + def test_streaming_response_create(self, client: Sent) -> None: with client.webhooks.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,7 +69,7 @@ def test_streaming_response_create(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve(self, client: SentDm) -> None: + def test_method_retrieve(self, client: Sent) -> None: webhook = client.webhooks.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -77,7 +77,7 @@ def test_method_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_retrieve_with_all_params(self, client: SentDm) -> None: + def test_method_retrieve_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -86,7 +86,7 @@ def test_method_retrieve_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_retrieve(self, client: SentDm) -> None: + def test_raw_response_retrieve(self, client: Sent) -> None: response = client.webhooks.with_raw_response.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -98,7 +98,7 @@ def test_raw_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_retrieve(self, client: SentDm) -> None: + def test_streaming_response_retrieve(self, client: Sent) -> None: with client.webhooks.with_streaming_response.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -112,7 +112,7 @@ def test_streaming_response_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_retrieve(self, client: SentDm) -> None: + def test_path_params_retrieve(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.retrieve( id="", @@ -120,7 +120,7 @@ def test_path_params_retrieve(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update(self, client: SentDm) -> None: + def test_method_update(self, client: Sent) -> None: webhook = client.webhooks.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -128,7 +128,7 @@ def test_method_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_update_with_all_params(self, client: SentDm) -> None: + def test_method_update_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", display_name="Updated Order Notifications", @@ -144,7 +144,7 @@ def test_method_update_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_update(self, client: SentDm) -> None: + def test_raw_response_update(self, client: Sent) -> None: response = client.webhooks.with_raw_response.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -156,7 +156,7 @@ def test_raw_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_update(self, client: SentDm) -> None: + def test_streaming_response_update(self, client: Sent) -> None: with client.webhooks.with_streaming_response.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -170,7 +170,7 @@ def test_streaming_response_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_update(self, client: SentDm) -> None: + def test_path_params_update(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.update( id="", @@ -178,7 +178,7 @@ def test_path_params_update(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list(self, client: SentDm) -> None: + def test_method_list(self, client: Sent) -> None: webhook = client.webhooks.list( page=0, page_size=0, @@ -187,7 +187,7 @@ def test_method_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_with_all_params(self, client: SentDm) -> None: + def test_method_list_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.list( page=0, page_size=0, @@ -199,7 +199,7 @@ def test_method_list_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list(self, client: SentDm) -> None: + def test_raw_response_list(self, client: Sent) -> None: response = client.webhooks.with_raw_response.list( page=0, page_size=0, @@ -212,7 +212,7 @@ def test_raw_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list(self, client: SentDm) -> None: + def test_streaming_response_list(self, client: Sent) -> None: with client.webhooks.with_streaming_response.list( page=0, page_size=0, @@ -227,7 +227,7 @@ def test_streaming_response_list(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete(self, client: SentDm) -> None: + def test_method_delete(self, client: Sent) -> None: webhook = client.webhooks.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -235,7 +235,7 @@ def test_method_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_delete_with_all_params(self, client: SentDm) -> None: + def test_method_delete_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -244,7 +244,7 @@ def test_method_delete_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_delete(self, client: SentDm) -> None: + def test_raw_response_delete(self, client: Sent) -> None: response = client.webhooks.with_raw_response.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -256,7 +256,7 @@ def test_raw_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_delete(self, client: SentDm) -> None: + def test_streaming_response_delete(self, client: Sent) -> None: with client.webhooks.with_streaming_response.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -270,7 +270,7 @@ def test_streaming_response_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_delete(self, client: SentDm) -> None: + def test_path_params_delete(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.delete( id="", @@ -278,13 +278,13 @@ def test_path_params_delete(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_event_types(self, client: SentDm) -> None: + def test_method_list_event_types(self, client: Sent) -> None: webhook = client.webhooks.list_event_types() assert_matches_type(WebhookListEventTypesResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_event_types_with_all_params(self, client: SentDm) -> None: + def test_method_list_event_types_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.list_event_types( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -292,7 +292,7 @@ def test_method_list_event_types_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list_event_types(self, client: SentDm) -> None: + def test_raw_response_list_event_types(self, client: Sent) -> None: response = client.webhooks.with_raw_response.list_event_types() assert response.is_closed is True @@ -302,7 +302,7 @@ def test_raw_response_list_event_types(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list_event_types(self, client: SentDm) -> None: + def test_streaming_response_list_event_types(self, client: Sent) -> None: with client.webhooks.with_streaming_response.list_event_types() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -314,7 +314,7 @@ def test_streaming_response_list_event_types(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_events(self, client: SentDm) -> None: + def test_method_list_events(self, client: Sent) -> None: webhook = client.webhooks.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -324,7 +324,7 @@ def test_method_list_events(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_list_events_with_all_params(self, client: SentDm) -> None: + def test_method_list_events_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -336,7 +336,7 @@ def test_method_list_events_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_list_events(self, client: SentDm) -> None: + def test_raw_response_list_events(self, client: Sent) -> None: response = client.webhooks.with_raw_response.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -350,7 +350,7 @@ def test_raw_response_list_events(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_list_events(self, client: SentDm) -> None: + def test_streaming_response_list_events(self, client: Sent) -> None: with client.webhooks.with_streaming_response.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -366,7 +366,7 @@ def test_streaming_response_list_events(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_list_events(self, client: SentDm) -> None: + def test_path_params_list_events(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.list_events( id="", @@ -376,7 +376,7 @@ def test_path_params_list_events(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_rotate_secret(self, client: SentDm) -> None: + def test_method_rotate_secret(self, client: Sent) -> None: webhook = client.webhooks.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -385,7 +385,7 @@ def test_method_rotate_secret(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_rotate_secret_with_all_params(self, client: SentDm) -> None: + def test_method_rotate_secret_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={"sandbox": False}, @@ -396,7 +396,7 @@ def test_method_rotate_secret_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_rotate_secret(self, client: SentDm) -> None: + def test_raw_response_rotate_secret(self, client: Sent) -> None: response = client.webhooks.with_raw_response.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -409,7 +409,7 @@ def test_raw_response_rotate_secret(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_rotate_secret(self, client: SentDm) -> None: + def test_streaming_response_rotate_secret(self, client: Sent) -> None: with client.webhooks.with_streaming_response.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -424,7 +424,7 @@ def test_streaming_response_rotate_secret(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_rotate_secret(self, client: SentDm) -> None: + def test_path_params_rotate_secret(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.rotate_secret( id="", @@ -433,7 +433,7 @@ def test_path_params_rotate_secret(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_test(self, client: SentDm) -> None: + def test_method_test(self, client: Sent) -> None: webhook = client.webhooks.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -441,7 +441,7 @@ def test_method_test(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_test_with_all_params(self, client: SentDm) -> None: + def test_method_test_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", event_type="message.sent", @@ -453,7 +453,7 @@ def test_method_test_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_test(self, client: SentDm) -> None: + def test_raw_response_test(self, client: Sent) -> None: response = client.webhooks.with_raw_response.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -465,7 +465,7 @@ def test_raw_response_test(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_test(self, client: SentDm) -> None: + def test_streaming_response_test(self, client: Sent) -> None: with client.webhooks.with_streaming_response.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -479,7 +479,7 @@ def test_streaming_response_test(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_test(self, client: SentDm) -> None: + def test_path_params_test(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.test( id="", @@ -487,7 +487,7 @@ def test_path_params_test(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_toggle_status(self, client: SentDm) -> None: + def test_method_toggle_status(self, client: Sent) -> None: webhook = client.webhooks.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -495,7 +495,7 @@ def test_method_toggle_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_method_toggle_status_with_all_params(self, client: SentDm) -> None: + def test_method_toggle_status_with_all_params(self, client: Sent) -> None: webhook = client.webhooks.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", is_active=False, @@ -507,7 +507,7 @@ def test_method_toggle_status_with_all_params(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_raw_response_toggle_status(self, client: SentDm) -> None: + def test_raw_response_toggle_status(self, client: Sent) -> None: response = client.webhooks.with_raw_response.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -519,7 +519,7 @@ def test_raw_response_toggle_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_streaming_response_toggle_status(self, client: SentDm) -> None: + def test_streaming_response_toggle_status(self, client: Sent) -> None: with client.webhooks.with_streaming_response.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -533,7 +533,7 @@ def test_streaming_response_toggle_status(self, client: SentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - def test_path_params_toggle_status(self, client: SentDm) -> None: + def test_path_params_toggle_status(self, client: Sent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.webhooks.with_raw_response.toggle_status( id="", @@ -547,13 +547,13 @@ class TestAsyncWebhooks: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create(self, async_client: AsyncSentDm) -> None: + async def test_method_create(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.create() assert_matches_type(APIResponseWebhook, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_create_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.create( display_name="Order Notifications", endpoint_url="https://example.com/webhooks/orders", @@ -568,7 +568,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_create(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.create() assert response.is_closed is True @@ -578,7 +578,7 @@ async def test_raw_response_create(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_create(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_create(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -590,7 +590,7 @@ async def test_streaming_response_create(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -598,7 +598,7 @@ async def test_method_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_retrieve_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -607,7 +607,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_retrieve(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -619,7 +619,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_retrieve(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.retrieve( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -633,7 +633,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: + async def test_path_params_retrieve(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.retrieve( id="", @@ -641,7 +641,7 @@ async def test_path_params_retrieve(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update(self, async_client: AsyncSentDm) -> None: + async def test_method_update(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -649,7 +649,7 @@ async def test_method_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_update_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", display_name="Updated Order Notifications", @@ -665,7 +665,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_update(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -677,7 +677,7 @@ async def test_raw_response_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_update(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_update(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.update( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -691,7 +691,7 @@ async def test_streaming_response_update(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_update(self, async_client: AsyncSentDm) -> None: + async def test_path_params_update(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.update( id="", @@ -699,7 +699,7 @@ async def test_path_params_update(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list(self, async_client: AsyncSentDm) -> None: + async def test_method_list(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list( page=0, page_size=0, @@ -708,7 +708,7 @@ async def test_method_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list( page=0, page_size=0, @@ -720,7 +720,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.list( page=0, page_size=0, @@ -733,7 +733,7 @@ async def test_raw_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.list( page=0, page_size=0, @@ -748,7 +748,7 @@ async def test_streaming_response_list(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete(self, async_client: AsyncSentDm) -> None: + async def test_method_delete(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -756,7 +756,7 @@ async def test_method_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_delete_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", @@ -765,7 +765,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_delete(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -777,7 +777,7 @@ async def test_raw_response_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_delete(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.delete( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -791,7 +791,7 @@ async def test_streaming_response_delete(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: + async def test_path_params_delete(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.delete( id="", @@ -799,13 +799,13 @@ async def test_path_params_delete(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_event_types(self, async_client: AsyncSentDm) -> None: + async def test_method_list_event_types(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list_event_types() assert_matches_type(WebhookListEventTypesResponse, webhook, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_event_types_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_event_types_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list_event_types( x_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) @@ -813,7 +813,7 @@ async def test_method_list_event_types_with_all_params(self, async_client: Async @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list_event_types(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list_event_types(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.list_event_types() assert response.is_closed is True @@ -823,7 +823,7 @@ async def test_raw_response_list_event_types(self, async_client: AsyncSentDm) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list_event_types(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list_event_types(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.list_event_types() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -835,7 +835,7 @@ async def test_streaming_response_list_event_types(self, async_client: AsyncSent @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_events(self, async_client: AsyncSentDm) -> None: + async def test_method_list_events(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -845,7 +845,7 @@ async def test_method_list_events(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_list_events_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_list_events_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -857,7 +857,7 @@ async def test_method_list_events_with_all_params(self, async_client: AsyncSentD @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_list_events(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_list_events(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -871,7 +871,7 @@ async def test_raw_response_list_events(self, async_client: AsyncSentDm) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_list_events(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_list_events(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.list_events( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", page=0, @@ -887,7 +887,7 @@ async def test_streaming_response_list_events(self, async_client: AsyncSentDm) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_list_events(self, async_client: AsyncSentDm) -> None: + async def test_path_params_list_events(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.list_events( id="", @@ -897,7 +897,7 @@ async def test_path_params_list_events(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_rotate_secret(self, async_client: AsyncSentDm) -> None: + async def test_method_rotate_secret(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -906,7 +906,7 @@ async def test_method_rotate_secret(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_rotate_secret_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_rotate_secret_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={"sandbox": False}, @@ -917,7 +917,7 @@ async def test_method_rotate_secret_with_all_params(self, async_client: AsyncSen @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_rotate_secret(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_rotate_secret(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -930,7 +930,7 @@ async def test_raw_response_rotate_secret(self, async_client: AsyncSentDm) -> No @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_rotate_secret(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_rotate_secret(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.rotate_secret( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", body={}, @@ -945,7 +945,7 @@ async def test_streaming_response_rotate_secret(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_rotate_secret(self, async_client: AsyncSentDm) -> None: + async def test_path_params_rotate_secret(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.rotate_secret( id="", @@ -954,7 +954,7 @@ async def test_path_params_rotate_secret(self, async_client: AsyncSentDm) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_test(self, async_client: AsyncSentDm) -> None: + async def test_method_test(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -962,7 +962,7 @@ async def test_method_test(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_test_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_test_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", event_type="message.sent", @@ -974,7 +974,7 @@ async def test_method_test_with_all_params(self, async_client: AsyncSentDm) -> N @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_test(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_test(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -986,7 +986,7 @@ async def test_raw_response_test(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_test(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_test(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.test( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -1000,7 +1000,7 @@ async def test_streaming_response_test(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_test(self, async_client: AsyncSentDm) -> None: + async def test_path_params_test(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.test( id="", @@ -1008,7 +1008,7 @@ async def test_path_params_test(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_toggle_status(self, async_client: AsyncSentDm) -> None: + async def test_method_toggle_status(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -1016,7 +1016,7 @@ async def test_method_toggle_status(self, async_client: AsyncSentDm) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_method_toggle_status_with_all_params(self, async_client: AsyncSentDm) -> None: + async def test_method_toggle_status_with_all_params(self, async_client: AsyncSent) -> None: webhook = await async_client.webhooks.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", is_active=False, @@ -1028,7 +1028,7 @@ async def test_method_toggle_status_with_all_params(self, async_client: AsyncSen @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_raw_response_toggle_status(self, async_client: AsyncSentDm) -> None: + async def test_raw_response_toggle_status(self, async_client: AsyncSent) -> None: response = await async_client.webhooks.with_raw_response.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) @@ -1040,7 +1040,7 @@ async def test_raw_response_toggle_status(self, async_client: AsyncSentDm) -> No @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_streaming_response_toggle_status(self, async_client: AsyncSentDm) -> None: + async def test_streaming_response_toggle_status(self, async_client: AsyncSent) -> None: async with async_client.webhooks.with_streaming_response.toggle_status( id="d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8", ) as response: @@ -1054,7 +1054,7 @@ async def test_streaming_response_toggle_status(self, async_client: AsyncSentDm) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize - async def test_path_params_toggle_status(self, async_client: AsyncSentDm) -> None: + async def test_path_params_toggle_status(self, async_client: AsyncSent) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.webhooks.with_raw_response.toggle_status( id="", diff --git a/tests/conftest.py b/tests/conftest.py index c4b3d682..87d8c229 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ import pytest from pytest_asyncio import is_async_test -from sent_dm import SentDm, AsyncSentDm, DefaultAioHttpClient +from sent_dm import Sent, AsyncSent, DefaultAioHttpClient from sent_dm._utils import is_dict if TYPE_CHECKING: @@ -49,17 +49,17 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: @pytest.fixture(scope="session") -def client(request: FixtureRequest) -> Iterator[SentDm]: +def client(request: FixtureRequest) -> Iterator[Sent]: strict = getattr(request, "param", True) if not isinstance(strict, bool): raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - with SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + with Sent(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: yield client @pytest.fixture(scope="session") -async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncSentDm]: +async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncSent]: param = getattr(request, "param", True) # defaults @@ -78,7 +78,7 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncSentDm]: else: raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") - async with AsyncSentDm( + async with AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client ) as client: yield client diff --git a/tests/test_client.py b/tests/test_client.py index 3de3d541..e578c1a2 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -19,11 +19,11 @@ from respx import MockRouter from pydantic import ValidationError -from sent_dm import SentDm, AsyncSentDm, APIResponseValidationError +from sent_dm import Sent, AsyncSent, APIResponseValidationError from sent_dm._types import Omit from sent_dm._utils import asyncify from sent_dm._models import BaseModel, FinalRequestOptions -from sent_dm._exceptions import SentDmError, APIStatusError, APITimeoutError, APIResponseValidationError +from sent_dm._exceptions import SentError, APIStatusError, APITimeoutError, APIResponseValidationError from sent_dm._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, @@ -103,7 +103,7 @@ async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] yield item -def _get_open_connections(client: SentDm | AsyncSentDm) -> int: +def _get_open_connections(client: Sent | AsyncSent) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -111,9 +111,9 @@ def _get_open_connections(client: SentDm | AsyncSentDm) -> int: return len(pool._requests) -class TestSentDm: +class TestSent: @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = client.post("/foo", cast_to=httpx.Response) @@ -122,7 +122,7 @@ def test_raw_response(self, respx_mock: MockRouter, client: SentDm) -> None: assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) @@ -132,7 +132,7 @@ def test_raw_response_for_binary(self, respx_mock: MockRouter, client: SentDm) - assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self, client: SentDm) -> None: + def test_copy(self, client: Sent) -> None: copied = client.copy() assert id(copied) != id(client) @@ -140,7 +140,7 @@ def test_copy(self, client: SentDm) -> None: assert copied.api_key == "another My API Key" assert client.api_key == "My API Key" - def test_copy_default_options(self, client: SentDm) -> None: + def test_copy_default_options(self, client: Sent) -> None: # options that have a default are overridden correctly copied = client.copy(max_retries=7) assert copied.max_retries == 7 @@ -157,7 +157,7 @@ def test_copy_default_options(self, client: SentDm) -> None: assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: - client = SentDm( + client = Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) assert client.default_headers["X-Foo"] == "bar" @@ -192,7 +192,7 @@ def test_copy_default_headers(self) -> None: client.close() def test_copy_default_query(self) -> None: - client = SentDm( + client = Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) assert _get_params(client)["foo"] == "bar" @@ -229,7 +229,7 @@ def test_copy_default_query(self) -> None: client.close() - def test_copy_signature(self, client: SentDm) -> None: + def test_copy_signature(self, client: Sent) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. @@ -246,7 +246,7 @@ def test_copy_signature(self, client: SentDm) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self, client: SentDm) -> None: + def test_copy_build_request(self, client: Sent) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: @@ -308,7 +308,7 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self, client: SentDm) -> None: + def test_request_timeout(self, client: Sent) -> None: request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT @@ -318,7 +318,7 @@ def test_request_timeout(self, client: SentDm) -> None: assert timeout == httpx.Timeout(100.0) def test_client_timeout_option(self) -> None: - client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) + client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -329,9 +329,7 @@ def test_client_timeout_option(self) -> None: def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: - client = SentDm( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -341,9 +339,7 @@ def test_http_client_timeout_option(self) -> None: # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: - client = SentDm( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -353,9 +349,7 @@ def test_http_client_timeout_option(self) -> None: # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = SentDm( - base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client - ) + client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -366,7 +360,7 @@ def test_http_client_timeout_option(self) -> None: async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: - SentDm( + Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -374,14 +368,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - test_client = SentDm( + test_client = Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - test_client2 = SentDm( + test_client2 = Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -398,17 +392,17 @@ def test_default_headers_option(self) -> None: test_client2.close() def test_validate_headers(self) -> None: - client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-api-key") == api_key - with pytest.raises(SentDmError): + with pytest.raises(SentError): with update_env(**{"SENT_DM_API_KEY": Omit()}): - client2 = SentDm(base_url=base_url, api_key=None, _strict_response_validation=True) + client2 = Sent(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 def test_default_query_option(self) -> None: - client = SentDm( + client = Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -427,7 +421,7 @@ def test_default_query_option(self) -> None: client.close() - def test_request_extra_json(self, client: SentDm) -> None: + def test_request_extra_json(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -461,7 +455,7 @@ def test_request_extra_json(self, client: SentDm) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self, client: SentDm) -> None: + def test_request_extra_headers(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -483,7 +477,7 @@ def test_request_extra_headers(self, client: SentDm) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self, client: SentDm) -> None: + def test_request_extra_query(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -524,7 +518,7 @@ def test_request_extra_query(self, client: SentDm) -> None: params = dict(request.url.params) assert params == {"foo": "2"} - def test_multipart_repeating_array(self, client: SentDm) -> None: + def test_multipart_repeating_array(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions.construct( method="post", @@ -554,7 +548,7 @@ def test_multipart_repeating_array(self, client: SentDm) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_binary_content_upload(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_binary_content_upload(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/upload").mock(side_effect=mirror_request_content) file_content = b"Hello, this is a test file." @@ -579,7 +573,7 @@ def mock_handler(request: httpx.Request) -> httpx.Response: assert counter.value == 0, "the request body should not have been read" return httpx.Response(200, content=request.read()) - with SentDm( + with Sent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -598,7 +592,7 @@ def mock_handler(request: httpx.Request) -> httpx.Response: assert counter.value == 1 @pytest.mark.respx(base_url=base_url) - def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/upload").mock(side_effect=mirror_request_content) file_content = b"Hello, this is a test file." @@ -618,7 +612,7 @@ def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRou assert response.content == file_content @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_basic_union_response(self, respx_mock: MockRouter, client: Sent) -> None: class Model1(BaseModel): name: str @@ -632,7 +626,7 @@ class Model2(BaseModel): assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: Sent) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -654,7 +648,7 @@ class Model2(BaseModel): assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: Sent) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -675,7 +669,7 @@ class Model(BaseModel): assert response.foo == 2 def test_base_url_setter(self) -> None: - client = SentDm(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + client = Sent(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -685,15 +679,15 @@ def test_base_url_setter(self) -> None: client.close() def test_base_url_env(self) -> None: - with update_env(SENT_DM_BASE_URL="http://localhost:5000/from/env"): - client = SentDm(api_key=api_key, _strict_response_validation=True) + with update_env(SENT_BASE_URL="http://localhost:5000/from/env"): + client = Sent(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @pytest.mark.parametrize( "client", [ - SentDm(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - SentDm( + Sent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Sent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -702,7 +696,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: SentDm) -> None: + def test_base_url_trailing_slash(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -716,8 +710,8 @@ def test_base_url_trailing_slash(self, client: SentDm) -> None: @pytest.mark.parametrize( "client", [ - SentDm(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - SentDm( + Sent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Sent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -726,7 +720,7 @@ def test_base_url_trailing_slash(self, client: SentDm) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: SentDm) -> None: + def test_base_url_no_trailing_slash(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -740,8 +734,8 @@ def test_base_url_no_trailing_slash(self, client: SentDm) -> None: @pytest.mark.parametrize( "client", [ - SentDm(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), - SentDm( + Sent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Sent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -750,7 +744,7 @@ def test_base_url_no_trailing_slash(self, client: SentDm) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: SentDm) -> None: + def test_absolute_request_url(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -762,7 +756,7 @@ def test_absolute_request_url(self, client: SentDm) -> None: client.close() def test_copied_client_does_not_close_http(self) -> None: - test_client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + test_client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True) assert not test_client.is_closed() copied = test_client.copy() @@ -773,7 +767,7 @@ def test_copied_client_does_not_close_http(self) -> None: assert not test_client.is_closed() def test_client_context_manager(self) -> None: - test_client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + test_client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True) with test_client as c2: assert c2 is test_client assert not c2.is_closed() @@ -781,7 +775,7 @@ def test_client_context_manager(self) -> None: assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: Sent) -> None: class Model(BaseModel): foo: str @@ -794,7 +788,7 @@ class Model(BaseModel): def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) + Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: @@ -803,12 +797,12 @@ class Model(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) - strict_client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + strict_client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - non_strict_client = SentDm(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = Sent(base_url=base_url, api_key=api_key, _strict_response_validation=False) response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] @@ -839,7 +833,7 @@ class Model(BaseModel): ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) def test_parse_retry_after_header( - self, remaining_retries: int, retry_after: str, timeout: float, client: SentDm + self, remaining_retries: int, retry_after: str, timeout: float, client: Sent ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) @@ -848,7 +842,7 @@ def test_parse_retry_after_header( @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/v3/messages").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): @@ -858,7 +852,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Sent) -> None: respx_mock.post("/v3/messages").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): @@ -871,7 +865,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client @pytest.mark.parametrize("failure_mode", ["status", "exception"]) def test_retries_taken( self, - client: SentDm, + client: Sent, failures_before_success: int, failure_mode: Literal["status", "exception"], respx_mock: MockRouter, @@ -899,9 +893,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_omit_retry_count_header( - self, client: SentDm, failures_before_success: int, respx_mock: MockRouter - ) -> None: + def test_omit_retry_count_header(self, client: Sent, failures_before_success: int, respx_mock: MockRouter) -> None: client = client.with_options(max_retries=4) nb_retries = 0 @@ -923,7 +915,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_overwrite_retry_count_header( - self, client: SentDm, failures_before_success: int, respx_mock: MockRouter + self, client: Sent, failures_before_success: int, respx_mock: MockRouter ) -> None: client = client.with_options(max_retries=4) @@ -973,7 +965,7 @@ def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - def test_follow_redirects(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_follow_redirects(self, respx_mock: MockRouter, client: Sent) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) @@ -985,7 +977,7 @@ def test_follow_redirects(self, respx_mock: MockRouter, client: SentDm) -> None: assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: SentDm) -> None: + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: Sent) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) @@ -998,9 +990,9 @@ def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: SentDm) assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" -class TestAsyncSentDm: +class TestAsyncSent: @pytest.mark.respx(base_url=base_url) - async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) response = await async_client.post("/foo", cast_to=httpx.Response) @@ -1009,7 +1001,7 @@ async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncSen assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) @@ -1019,7 +1011,7 @@ async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_clien assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self, async_client: AsyncSentDm) -> None: + def test_copy(self, async_client: AsyncSent) -> None: copied = async_client.copy() assert id(copied) != id(async_client) @@ -1027,7 +1019,7 @@ def test_copy(self, async_client: AsyncSentDm) -> None: assert copied.api_key == "another My API Key" assert async_client.api_key == "My API Key" - def test_copy_default_options(self, async_client: AsyncSentDm) -> None: + def test_copy_default_options(self, async_client: AsyncSent) -> None: # options that have a default are overridden correctly copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 @@ -1044,7 +1036,7 @@ def test_copy_default_options(self, async_client: AsyncSentDm) -> None: assert isinstance(async_client.timeout, httpx.Timeout) async def test_copy_default_headers(self) -> None: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) assert client.default_headers["X-Foo"] == "bar" @@ -1079,7 +1071,7 @@ async def test_copy_default_headers(self) -> None: await client.close() async def test_copy_default_query(self) -> None: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) assert _get_params(client)["foo"] == "bar" @@ -1116,7 +1108,7 @@ async def test_copy_default_query(self) -> None: await client.close() - def test_copy_signature(self, async_client: AsyncSentDm) -> None: + def test_copy_signature(self, async_client: AsyncSent) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. @@ -1133,7 +1125,7 @@ def test_copy_signature(self, async_client: AsyncSentDm) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self, async_client: AsyncSentDm) -> None: + def test_copy_build_request(self, async_client: AsyncSent) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: @@ -1195,7 +1187,7 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self, async_client: AsyncSentDm) -> None: + async def test_request_timeout(self, async_client: AsyncSent) -> None: request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT @@ -1207,7 +1199,7 @@ async def test_request_timeout(self, async_client: AsyncSentDm) -> None: assert timeout == httpx.Timeout(100.0) async def test_client_timeout_option(self) -> None: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) ) @@ -1220,7 +1212,7 @@ async def test_client_timeout_option(self) -> None: async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -1232,7 +1224,7 @@ async def test_http_client_timeout_option(self) -> None: # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -1244,7 +1236,7 @@ async def test_http_client_timeout_option(self) -> None: # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client ) @@ -1257,7 +1249,7 @@ async def test_http_client_timeout_option(self) -> None: def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: - AsyncSentDm( + AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1265,14 +1257,14 @@ def test_invalid_http_client(self) -> None: ) async def test_default_headers_option(self) -> None: - test_client = AsyncSentDm( + test_client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - test_client2 = AsyncSentDm( + test_client2 = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1289,17 +1281,17 @@ async def test_default_headers_option(self) -> None: await test_client2.close() def test_validate_headers(self) -> None: - client = AsyncSentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client = AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-api-key") == api_key - with pytest.raises(SentDmError): + with pytest.raises(SentError): with update_env(**{"SENT_DM_API_KEY": Omit()}): - client2 = AsyncSentDm(base_url=base_url, api_key=None, _strict_response_validation=True) + client2 = AsyncSent(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 async def test_default_query_option(self) -> None: - client = AsyncSentDm( + client = AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -1318,7 +1310,7 @@ async def test_default_query_option(self) -> None: await client.close() - def test_request_extra_json(self, client: SentDm) -> None: + def test_request_extra_json(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1352,7 +1344,7 @@ def test_request_extra_json(self, client: SentDm) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self, client: SentDm) -> None: + def test_request_extra_headers(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1374,7 +1366,7 @@ def test_request_extra_headers(self, client: SentDm) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self, client: SentDm) -> None: + def test_request_extra_query(self, client: Sent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1415,7 +1407,7 @@ def test_request_extra_query(self, client: SentDm) -> None: params = dict(request.url.params) assert params == {"foo": "2"} - def test_multipart_repeating_array(self, async_client: AsyncSentDm) -> None: + def test_multipart_repeating_array(self, async_client: AsyncSent) -> None: request = async_client._build_request( FinalRequestOptions.construct( method="post", @@ -1445,7 +1437,7 @@ def test_multipart_repeating_array(self, async_client: AsyncSentDm) -> None: ] @pytest.mark.respx(base_url=base_url) - async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: respx_mock.post("/upload").mock(side_effect=mirror_request_content) file_content = b"Hello, this is a test file." @@ -1470,7 +1462,7 @@ async def mock_handler(request: httpx.Request) -> httpx.Response: assert counter.value == 0, "the request body should not have been read" return httpx.Response(200, content=await request.aread()) - async with AsyncSentDm( + async with AsyncSent( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1490,7 +1482,7 @@ async def mock_handler(request: httpx.Request) -> httpx.Response: @pytest.mark.respx(base_url=base_url) async def test_binary_content_upload_with_body_is_deprecated( - self, respx_mock: MockRouter, async_client: AsyncSentDm + self, respx_mock: MockRouter, async_client: AsyncSent ) -> None: respx_mock.post("/upload").mock(side_effect=mirror_request_content) @@ -1511,7 +1503,7 @@ async def test_binary_content_upload_with_body_is_deprecated( assert response.content == file_content @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: class Model1(BaseModel): name: str @@ -1525,7 +1517,7 @@ class Model2(BaseModel): assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1548,7 +1540,7 @@ class Model2(BaseModel): @pytest.mark.respx(base_url=base_url) async def test_non_application_json_content_type_for_json_data( - self, respx_mock: MockRouter, async_client: AsyncSentDm + self, respx_mock: MockRouter, async_client: AsyncSent ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data @@ -1570,9 +1562,7 @@ class Model(BaseModel): assert response.foo == 2 async def test_base_url_setter(self) -> None: - client = AsyncSentDm( - base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True - ) + client = AsyncSent(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" client.base_url = "https://example.com/from_setter" # type: ignore[assignment] @@ -1582,17 +1572,15 @@ async def test_base_url_setter(self) -> None: await client.close() async def test_base_url_env(self) -> None: - with update_env(SENT_DM_BASE_URL="http://localhost:5000/from/env"): - client = AsyncSentDm(api_key=api_key, _strict_response_validation=True) + with update_env(SENT_BASE_URL="http://localhost:5000/from/env"): + client = AsyncSent(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @pytest.mark.parametrize( "client", [ - AsyncSentDm( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncSentDm( + AsyncSent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + AsyncSent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1601,7 +1589,7 @@ async def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - async def test_base_url_trailing_slash(self, client: AsyncSentDm) -> None: + async def test_base_url_trailing_slash(self, client: AsyncSent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1615,10 +1603,8 @@ async def test_base_url_trailing_slash(self, client: AsyncSentDm) -> None: @pytest.mark.parametrize( "client", [ - AsyncSentDm( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncSentDm( + AsyncSent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + AsyncSent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1627,7 +1613,7 @@ async def test_base_url_trailing_slash(self, client: AsyncSentDm) -> None: ], ids=["standard", "custom http client"], ) - async def test_base_url_no_trailing_slash(self, client: AsyncSentDm) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncSent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1641,10 +1627,8 @@ async def test_base_url_no_trailing_slash(self, client: AsyncSentDm) -> None: @pytest.mark.parametrize( "client", [ - AsyncSentDm( - base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True - ), - AsyncSentDm( + AsyncSent(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + AsyncSent( base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True, @@ -1653,7 +1637,7 @@ async def test_base_url_no_trailing_slash(self, client: AsyncSentDm) -> None: ], ids=["standard", "custom http client"], ) - async def test_absolute_request_url(self, client: AsyncSentDm) -> None: + async def test_absolute_request_url(self, client: AsyncSent) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1665,7 +1649,7 @@ async def test_absolute_request_url(self, client: AsyncSentDm) -> None: await client.close() async def test_copied_client_does_not_close_http(self) -> None: - test_client = AsyncSentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + test_client = AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=True) assert not test_client.is_closed() copied = test_client.copy() @@ -1677,7 +1661,7 @@ async def test_copied_client_does_not_close_http(self) -> None: assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - test_client = AsyncSentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + test_client = AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with test_client as c2: assert c2 is test_client assert not c2.is_closed() @@ -1685,7 +1669,7 @@ async def test_client_context_manager(self) -> None: assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: class Model(BaseModel): foo: str @@ -1698,9 +1682,7 @@ class Model(BaseModel): async def test_client_max_retries_validation(self) -> None: with pytest.raises(TypeError, match=r"max_retries cannot be None"): - AsyncSentDm( - base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) - ) + AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) @pytest.mark.respx(base_url=base_url) async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: @@ -1709,12 +1691,12 @@ class Model(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) - strict_client = AsyncSentDm(base_url=base_url, api_key=api_key, _strict_response_validation=True) + strict_client = AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=True) with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - non_strict_client = AsyncSentDm(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncSent(base_url=base_url, api_key=api_key, _strict_response_validation=False) response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] @@ -1745,7 +1727,7 @@ class Model(BaseModel): ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) async def test_parse_retry_after_header( - self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncSentDm + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncSent ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) @@ -1754,7 +1736,7 @@ async def test_parse_retry_after_header( @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: respx_mock.post("/v3/messages").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): @@ -1764,7 +1746,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: respx_mock.post("/v3/messages").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): @@ -1777,7 +1759,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( self, - async_client: AsyncSentDm, + async_client: AsyncSent, failures_before_success: int, failure_mode: Literal["status", "exception"], respx_mock: MockRouter, @@ -1806,7 +1788,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_omit_retry_count_header( - self, async_client: AsyncSentDm, failures_before_success: int, respx_mock: MockRouter + self, async_client: AsyncSent, failures_before_success: int, respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1829,7 +1811,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @mock.patch("sent_dm._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_overwrite_retry_count_header( - self, async_client: AsyncSentDm, failures_before_success: int, respx_mock: MockRouter + self, async_client: AsyncSent, failures_before_success: int, respx_mock: MockRouter ) -> None: client = async_client.with_options(max_retries=4) @@ -1883,7 +1865,7 @@ async def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) @@ -1895,7 +1877,7 @@ async def test_follow_redirects(self, respx_mock: MockRouter, async_client: Asyn assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncSentDm) -> None: + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncSent) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) diff --git a/tests/test_response.py b/tests/test_response.py index ffde6057..87c4a89b 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -6,7 +6,7 @@ import pytest import pydantic -from sent_dm import SentDm, BaseModel, AsyncSentDm +from sent_dm import Sent, AsyncSent, BaseModel from sent_dm._response import ( APIResponse, BaseAPIResponse, @@ -56,7 +56,7 @@ def test_extract_response_type_binary_response() -> None: class PydanticModel(pydantic.BaseModel): ... -def test_response_parse_mismatched_basemodel(client: SentDm) -> None: +def test_response_parse_mismatched_basemodel(client: Sent) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo"), client=client, @@ -74,7 +74,7 @@ def test_response_parse_mismatched_basemodel(client: SentDm) -> None: @pytest.mark.asyncio -async def test_async_response_parse_mismatched_basemodel(async_client: AsyncSentDm) -> None: +async def test_async_response_parse_mismatched_basemodel(async_client: AsyncSent) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=b"foo"), client=async_client, @@ -91,7 +91,7 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncSent await response.parse(to=PydanticModel) -def test_response_parse_custom_stream(client: SentDm) -> None: +def test_response_parse_custom_stream(client: Sent) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo"), client=client, @@ -106,7 +106,7 @@ def test_response_parse_custom_stream(client: SentDm) -> None: @pytest.mark.asyncio -async def test_async_response_parse_custom_stream(async_client: AsyncSentDm) -> None: +async def test_async_response_parse_custom_stream(async_client: AsyncSent) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=b"foo"), client=async_client, @@ -125,7 +125,7 @@ class CustomModel(BaseModel): bar: int -def test_response_parse_custom_model(client: SentDm) -> None: +def test_response_parse_custom_model(client: Sent) -> None: response = APIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=client, @@ -141,7 +141,7 @@ def test_response_parse_custom_model(client: SentDm) -> None: @pytest.mark.asyncio -async def test_async_response_parse_custom_model(async_client: AsyncSentDm) -> None: +async def test_async_response_parse_custom_model(async_client: AsyncSent) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=async_client, @@ -156,7 +156,7 @@ async def test_async_response_parse_custom_model(async_client: AsyncSentDm) -> N assert obj.bar == 2 -def test_response_parse_annotated_type(client: SentDm) -> None: +def test_response_parse_annotated_type(client: Sent) -> None: response = APIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=client, @@ -173,7 +173,7 @@ def test_response_parse_annotated_type(client: SentDm) -> None: assert obj.bar == 2 -async def test_async_response_parse_annotated_type(async_client: AsyncSentDm) -> None: +async def test_async_response_parse_annotated_type(async_client: AsyncSent) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), client=async_client, @@ -201,7 +201,7 @@ async def test_async_response_parse_annotated_type(async_client: AsyncSentDm) -> ("FalSe", False), ], ) -def test_response_parse_bool(client: SentDm, content: str, expected: bool) -> None: +def test_response_parse_bool(client: Sent, content: str, expected: bool) -> None: response = APIResponse( raw=httpx.Response(200, content=content), client=client, @@ -226,7 +226,7 @@ def test_response_parse_bool(client: SentDm, content: str, expected: bool) -> No ("FalSe", False), ], ) -async def test_async_response_parse_bool(client: AsyncSentDm, content: str, expected: bool) -> None: +async def test_async_response_parse_bool(client: AsyncSent, content: str, expected: bool) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=content), client=client, @@ -245,7 +245,7 @@ class OtherModel(BaseModel): @pytest.mark.parametrize("client", [False], indirect=True) # loose validation -def test_response_parse_expect_model_union_non_json_content(client: SentDm) -> None: +def test_response_parse_expect_model_union_non_json_content(client: Sent) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), client=client, @@ -262,7 +262,7 @@ def test_response_parse_expect_model_union_non_json_content(client: SentDm) -> N @pytest.mark.asyncio @pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation -async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncSentDm) -> None: +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncSent) -> None: response = AsyncAPIResponse( raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), client=async_client, diff --git a/tests/test_streaming.py b/tests/test_streaming.py index e2815656..669cc396 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -5,13 +5,13 @@ import httpx import pytest -from sent_dm import SentDm, AsyncSentDm +from sent_dm import Sent, AsyncSent from sent_dm._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_basic(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_basic(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: completion\n" yield b'data: {"foo":true}\n' @@ -28,7 +28,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_data_missing_event(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_data_missing_event(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b'data: {"foo":true}\n' yield b"\n" @@ -44,7 +44,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_event_missing_data(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_event_missing_data(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -60,7 +60,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_multiple_events(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"\n" @@ -82,7 +82,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_events_with_data(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_multiple_events_with_data(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b'data: {"foo":true}\n' @@ -106,7 +106,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_data_lines_with_empty_line(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_multiple_data_lines_with_empty_line(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"data: {\n" @@ -128,7 +128,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_data_json_escaped_double_new_line(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_data_json_escaped_double_new_line(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b'data: {"foo": "my long\\n\\ncontent"}' @@ -145,7 +145,7 @@ def body() -> Iterator[bytes]: @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) -async def test_multiple_data_lines(sync: bool, client: SentDm, async_client: AsyncSentDm) -> None: +async def test_multiple_data_lines(sync: bool, client: Sent, async_client: AsyncSent) -> None: def body() -> Iterator[bytes]: yield b"event: ping\n" yield b"data: {\n" @@ -165,8 +165,8 @@ def body() -> Iterator[bytes]: @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) async def test_special_new_line_character( sync: bool, - client: SentDm, - async_client: AsyncSentDm, + client: Sent, + async_client: AsyncSent, ) -> None: def body() -> Iterator[bytes]: yield b'data: {"content":" culpa"}\n' @@ -196,8 +196,8 @@ def body() -> Iterator[bytes]: @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) async def test_multi_byte_character_multiple_chunks( sync: bool, - client: SentDm, - async_client: AsyncSentDm, + client: Sent, + async_client: AsyncSent, ) -> None: def body() -> Iterator[bytes]: yield b'data: {"content":"' @@ -237,8 +237,8 @@ def make_event_iterator( content: Iterator[bytes], *, sync: bool, - client: SentDm, - async_client: AsyncSentDm, + client: Sent, + async_client: AsyncSent, ) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: if sync: return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events()