| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
import os |
| 4 |
from typing import Any, cast |
| 5 |
|
| 6 |
import pytest |
| 7 |
|
| 8 |
from anthropic import Anthropic, AsyncAnthropic |
| 9 |
from tests.utils import assert_matches_type |
| 10 |
from anthropic.pagination import SyncPageCursor, AsyncPageCursor |
| 11 |
from anthropic.types.beta.tunnels import BetaTunnelCertificate |
| 12 |
|
| 13 |
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") |
| 14 |
|
| 15 |
|
| 16 |
class TestCertificates: |
| 17 |
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) |
| 18 |
|
| 19 |
@parametrize |
| 20 |
def test_method_create(self, client: Anthropic) -> None: |
| 21 |
certificate = client.beta.tunnels.certificates.create( |
| 22 |
tunnel_id="tunnel_id", |
| 23 |
ca_certificate_pem="ca_certificate_pem", |
| 24 |
) |
| 25 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 26 |
|
| 27 |
@parametrize |
| 28 |
def test_method_create_with_all_params(self, client: Anthropic) -> None: |
| 29 |
certificate = client.beta.tunnels.certificates.create( |
| 30 |
tunnel_id="tunnel_id", |
| 31 |
ca_certificate_pem="ca_certificate_pem", |
| 32 |
betas=["message-batches-2024-09-24"], |
| 33 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 34 |
) |
| 35 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 36 |
|
| 37 |
@parametrize |
| 38 |
def test_raw_response_create(self, client: Anthropic) -> None: |
| 39 |
response = client.beta.tunnels.certificates.with_raw_response.create( |
| 40 |
tunnel_id="tunnel_id", |
| 41 |
ca_certificate_pem="ca_certificate_pem", |
| 42 |
) |
| 43 |
|
| 44 |
assert response.is_closed is True |
| 45 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 46 |
certificate = response.parse() |
| 47 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 48 |
|
| 49 |
@parametrize |
| 50 |
def test_streaming_response_create(self, client: Anthropic) -> None: |
| 51 |
with client.beta.tunnels.certificates.with_streaming_response.create( |
| 52 |
tunnel_id="tunnel_id", |
| 53 |
ca_certificate_pem="ca_certificate_pem", |
| 54 |
) as response: |
| 55 |
assert not response.is_closed |
| 56 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 57 |
|
| 58 |
certificate = response.parse() |
| 59 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 60 |
|
| 61 |
assert cast(Any, response.is_closed) is True |
| 62 |
|
| 63 |
@parametrize |
| 64 |
def test_path_params_create(self, client: Anthropic) -> None: |
| 65 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 66 |
client.beta.tunnels.certificates.with_raw_response.create( |
| 67 |
tunnel_id="", |
| 68 |
ca_certificate_pem="ca_certificate_pem", |
| 69 |
) |
| 70 |
|
| 71 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 72 |
@parametrize |
| 73 |
def test_method_retrieve(self, client: Anthropic) -> None: |
| 74 |
certificate = client.beta.tunnels.certificates.retrieve( |
| 75 |
certificate_id="certificate_id", |
| 76 |
tunnel_id="tunnel_id", |
| 77 |
) |
| 78 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 79 |
|
| 80 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 81 |
@parametrize |
| 82 |
def test_method_retrieve_with_all_params(self, client: Anthropic) -> None: |
| 83 |
certificate = client.beta.tunnels.certificates.retrieve( |
| 84 |
certificate_id="certificate_id", |
| 85 |
tunnel_id="tunnel_id", |
| 86 |
betas=["message-batches-2024-09-24"], |
| 87 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 88 |
) |
| 89 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 90 |
|
| 91 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 92 |
@parametrize |
| 93 |
def test_raw_response_retrieve(self, client: Anthropic) -> None: |
| 94 |
response = client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 95 |
certificate_id="certificate_id", |
| 96 |
tunnel_id="tunnel_id", |
| 97 |
) |
| 98 |
|
| 99 |
assert response.is_closed is True |
| 100 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 101 |
certificate = response.parse() |
| 102 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 103 |
|
| 104 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 105 |
@parametrize |
| 106 |
def test_streaming_response_retrieve(self, client: Anthropic) -> None: |
| 107 |
with client.beta.tunnels.certificates.with_streaming_response.retrieve( |
| 108 |
certificate_id="certificate_id", |
| 109 |
tunnel_id="tunnel_id", |
| 110 |
) as response: |
| 111 |
assert not response.is_closed |
| 112 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 113 |
|
| 114 |
certificate = response.parse() |
| 115 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 116 |
|
| 117 |
assert cast(Any, response.is_closed) is True |
| 118 |
|
| 119 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 120 |
@parametrize |
| 121 |
def test_path_params_retrieve(self, client: Anthropic) -> None: |
| 122 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 123 |
client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 124 |
certificate_id="certificate_id", |
| 125 |
tunnel_id="", |
| 126 |
) |
| 127 |
|
| 128 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): |
| 129 |
client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 130 |
certificate_id="", |
| 131 |
tunnel_id="tunnel_id", |
| 132 |
) |
| 133 |
|
| 134 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 135 |
@parametrize |
| 136 |
def test_method_list(self, client: Anthropic) -> None: |
| 137 |
certificate = client.beta.tunnels.certificates.list( |
| 138 |
tunnel_id="tunnel_id", |
| 139 |
) |
| 140 |
assert_matches_type(SyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 141 |
|
| 142 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 143 |
@parametrize |
| 144 |
def test_method_list_with_all_params(self, client: Anthropic) -> None: |
| 145 |
certificate = client.beta.tunnels.certificates.list( |
| 146 |
tunnel_id="tunnel_id", |
| 147 |
include_archived=True, |
| 148 |
limit=0, |
| 149 |
page="page", |
| 150 |
betas=["message-batches-2024-09-24"], |
| 151 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 152 |
) |
| 153 |
assert_matches_type(SyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 154 |
|
| 155 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 156 |
@parametrize |
| 157 |
def test_raw_response_list(self, client: Anthropic) -> None: |
| 158 |
response = client.beta.tunnels.certificates.with_raw_response.list( |
| 159 |
tunnel_id="tunnel_id", |
| 160 |
) |
| 161 |
|
| 162 |
assert response.is_closed is True |
| 163 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 164 |
certificate = response.parse() |
| 165 |
assert_matches_type(SyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 166 |
|
| 167 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 168 |
@parametrize |
| 169 |
def test_streaming_response_list(self, client: Anthropic) -> None: |
| 170 |
with client.beta.tunnels.certificates.with_streaming_response.list( |
| 171 |
tunnel_id="tunnel_id", |
| 172 |
) as response: |
| 173 |
assert not response.is_closed |
| 174 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 175 |
|
| 176 |
certificate = response.parse() |
| 177 |
assert_matches_type(SyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 178 |
|
| 179 |
assert cast(Any, response.is_closed) is True |
| 180 |
|
| 181 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 182 |
@parametrize |
| 183 |
def test_path_params_list(self, client: Anthropic) -> None: |
| 184 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 185 |
client.beta.tunnels.certificates.with_raw_response.list( |
| 186 |
tunnel_id="", |
| 187 |
) |
| 188 |
|
| 189 |
@parametrize |
| 190 |
def test_method_archive(self, client: Anthropic) -> None: |
| 191 |
certificate = client.beta.tunnels.certificates.archive( |
| 192 |
certificate_id="certificate_id", |
| 193 |
tunnel_id="tunnel_id", |
| 194 |
) |
| 195 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 196 |
|
| 197 |
@parametrize |
| 198 |
def test_method_archive_with_all_params(self, client: Anthropic) -> None: |
| 199 |
certificate = client.beta.tunnels.certificates.archive( |
| 200 |
certificate_id="certificate_id", |
| 201 |
tunnel_id="tunnel_id", |
| 202 |
betas=["message-batches-2024-09-24"], |
| 203 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 204 |
) |
| 205 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 206 |
|
| 207 |
@parametrize |
| 208 |
def test_raw_response_archive(self, client: Anthropic) -> None: |
| 209 |
response = client.beta.tunnels.certificates.with_raw_response.archive( |
| 210 |
certificate_id="certificate_id", |
| 211 |
tunnel_id="tunnel_id", |
| 212 |
) |
| 213 |
|
| 214 |
assert response.is_closed is True |
| 215 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 216 |
certificate = response.parse() |
| 217 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 218 |
|
| 219 |
@parametrize |
| 220 |
def test_streaming_response_archive(self, client: Anthropic) -> None: |
| 221 |
with client.beta.tunnels.certificates.with_streaming_response.archive( |
| 222 |
certificate_id="certificate_id", |
| 223 |
tunnel_id="tunnel_id", |
| 224 |
) as response: |
| 225 |
assert not response.is_closed |
| 226 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 227 |
|
| 228 |
certificate = response.parse() |
| 229 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 230 |
|
| 231 |
assert cast(Any, response.is_closed) is True |
| 232 |
|
| 233 |
@parametrize |
| 234 |
def test_path_params_archive(self, client: Anthropic) -> None: |
| 235 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 236 |
client.beta.tunnels.certificates.with_raw_response.archive( |
| 237 |
certificate_id="certificate_id", |
| 238 |
tunnel_id="", |
| 239 |
) |
| 240 |
|
| 241 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): |
| 242 |
client.beta.tunnels.certificates.with_raw_response.archive( |
| 243 |
certificate_id="", |
| 244 |
tunnel_id="tunnel_id", |
| 245 |
) |
| 246 |
|
| 247 |
|
| 248 |
class TestAsyncCertificates: |
| 249 |
parametrize = pytest.mark.parametrize( |
| 250 |
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] |
| 251 |
) |
| 252 |
|
| 253 |
@parametrize |
| 254 |
async def test_method_create(self, async_client: AsyncAnthropic) -> None: |
| 255 |
certificate = await async_client.beta.tunnels.certificates.create( |
| 256 |
tunnel_id="tunnel_id", |
| 257 |
ca_certificate_pem="ca_certificate_pem", |
| 258 |
) |
| 259 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 260 |
|
| 261 |
@parametrize |
| 262 |
async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) -> None: |
| 263 |
certificate = await async_client.beta.tunnels.certificates.create( |
| 264 |
tunnel_id="tunnel_id", |
| 265 |
ca_certificate_pem="ca_certificate_pem", |
| 266 |
betas=["message-batches-2024-09-24"], |
| 267 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 268 |
) |
| 269 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 270 |
|
| 271 |
@parametrize |
| 272 |
async def test_raw_response_create(self, async_client: AsyncAnthropic) -> None: |
| 273 |
response = await async_client.beta.tunnels.certificates.with_raw_response.create( |
| 274 |
tunnel_id="tunnel_id", |
| 275 |
ca_certificate_pem="ca_certificate_pem", |
| 276 |
) |
| 277 |
|
| 278 |
assert response.is_closed is True |
| 279 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 280 |
certificate = await response.parse() |
| 281 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 282 |
|
| 283 |
@parametrize |
| 284 |
async def test_streaming_response_create(self, async_client: AsyncAnthropic) -> None: |
| 285 |
async with async_client.beta.tunnels.certificates.with_streaming_response.create( |
| 286 |
tunnel_id="tunnel_id", |
| 287 |
ca_certificate_pem="ca_certificate_pem", |
| 288 |
) as response: |
| 289 |
assert not response.is_closed |
| 290 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 291 |
|
| 292 |
certificate = await response.parse() |
| 293 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 294 |
|
| 295 |
assert cast(Any, response.is_closed) is True |
| 296 |
|
| 297 |
@parametrize |
| 298 |
async def test_path_params_create(self, async_client: AsyncAnthropic) -> None: |
| 299 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 300 |
await async_client.beta.tunnels.certificates.with_raw_response.create( |
| 301 |
tunnel_id="", |
| 302 |
ca_certificate_pem="ca_certificate_pem", |
| 303 |
) |
| 304 |
|
| 305 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 306 |
@parametrize |
| 307 |
async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None: |
| 308 |
certificate = await async_client.beta.tunnels.certificates.retrieve( |
| 309 |
certificate_id="certificate_id", |
| 310 |
tunnel_id="tunnel_id", |
| 311 |
) |
| 312 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 313 |
|
| 314 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 315 |
@parametrize |
| 316 |
async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None: |
| 317 |
certificate = await async_client.beta.tunnels.certificates.retrieve( |
| 318 |
certificate_id="certificate_id", |
| 319 |
tunnel_id="tunnel_id", |
| 320 |
betas=["message-batches-2024-09-24"], |
| 321 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 322 |
) |
| 323 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 324 |
|
| 325 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 326 |
@parametrize |
| 327 |
async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None: |
| 328 |
response = await async_client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 329 |
certificate_id="certificate_id", |
| 330 |
tunnel_id="tunnel_id", |
| 331 |
) |
| 332 |
|
| 333 |
assert response.is_closed is True |
| 334 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 335 |
certificate = await response.parse() |
| 336 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 337 |
|
| 338 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 339 |
@parametrize |
| 340 |
async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None: |
| 341 |
async with async_client.beta.tunnels.certificates.with_streaming_response.retrieve( |
| 342 |
certificate_id="certificate_id", |
| 343 |
tunnel_id="tunnel_id", |
| 344 |
) as response: |
| 345 |
assert not response.is_closed |
| 346 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 347 |
|
| 348 |
certificate = await response.parse() |
| 349 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 350 |
|
| 351 |
assert cast(Any, response.is_closed) is True |
| 352 |
|
| 353 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 354 |
@parametrize |
| 355 |
async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None: |
| 356 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 357 |
await async_client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 358 |
certificate_id="certificate_id", |
| 359 |
tunnel_id="", |
| 360 |
) |
| 361 |
|
| 362 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): |
| 363 |
await async_client.beta.tunnels.certificates.with_raw_response.retrieve( |
| 364 |
certificate_id="", |
| 365 |
tunnel_id="tunnel_id", |
| 366 |
) |
| 367 |
|
| 368 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 369 |
@parametrize |
| 370 |
async def test_method_list(self, async_client: AsyncAnthropic) -> None: |
| 371 |
certificate = await async_client.beta.tunnels.certificates.list( |
| 372 |
tunnel_id="tunnel_id", |
| 373 |
) |
| 374 |
assert_matches_type(AsyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 375 |
|
| 376 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 377 |
@parametrize |
| 378 |
async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None: |
| 379 |
certificate = await async_client.beta.tunnels.certificates.list( |
| 380 |
tunnel_id="tunnel_id", |
| 381 |
include_archived=True, |
| 382 |
limit=0, |
| 383 |
page="page", |
| 384 |
betas=["message-batches-2024-09-24"], |
| 385 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 386 |
) |
| 387 |
assert_matches_type(AsyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 388 |
|
| 389 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 390 |
@parametrize |
| 391 |
async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None: |
| 392 |
response = await async_client.beta.tunnels.certificates.with_raw_response.list( |
| 393 |
tunnel_id="tunnel_id", |
| 394 |
) |
| 395 |
|
| 396 |
assert response.is_closed is True |
| 397 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 398 |
certificate = await response.parse() |
| 399 |
assert_matches_type(AsyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 400 |
|
| 401 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 402 |
@parametrize |
| 403 |
async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None: |
| 404 |
async with async_client.beta.tunnels.certificates.with_streaming_response.list( |
| 405 |
tunnel_id="tunnel_id", |
| 406 |
) as response: |
| 407 |
assert not response.is_closed |
| 408 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 409 |
|
| 410 |
certificate = await response.parse() |
| 411 |
assert_matches_type(AsyncPageCursor[BetaTunnelCertificate], certificate, path=["response"]) |
| 412 |
|
| 413 |
assert cast(Any, response.is_closed) is True |
| 414 |
|
| 415 |
@pytest.mark.skip(reason="buildURL drops path-level query params") |
| 416 |
@parametrize |
| 417 |
async def test_path_params_list(self, async_client: AsyncAnthropic) -> None: |
| 418 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 419 |
await async_client.beta.tunnels.certificates.with_raw_response.list( |
| 420 |
tunnel_id="", |
| 421 |
) |
| 422 |
|
| 423 |
@parametrize |
| 424 |
async def test_method_archive(self, async_client: AsyncAnthropic) -> None: |
| 425 |
certificate = await async_client.beta.tunnels.certificates.archive( |
| 426 |
certificate_id="certificate_id", |
| 427 |
tunnel_id="tunnel_id", |
| 428 |
) |
| 429 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 430 |
|
| 431 |
@parametrize |
| 432 |
async def test_method_archive_with_all_params(self, async_client: AsyncAnthropic) -> None: |
| 433 |
certificate = await async_client.beta.tunnels.certificates.archive( |
| 434 |
certificate_id="certificate_id", |
| 435 |
tunnel_id="tunnel_id", |
| 436 |
betas=["message-batches-2024-09-24"], |
| 437 |
workspace_id="wrkspc_011CZkZaBF1tNoB5wlCeusgy", |
| 438 |
) |
| 439 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 440 |
|
| 441 |
@parametrize |
| 442 |
async def test_raw_response_archive(self, async_client: AsyncAnthropic) -> None: |
| 443 |
response = await async_client.beta.tunnels.certificates.with_raw_response.archive( |
| 444 |
certificate_id="certificate_id", |
| 445 |
tunnel_id="tunnel_id", |
| 446 |
) |
| 447 |
|
| 448 |
assert response.is_closed is True |
| 449 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 450 |
certificate = await response.parse() |
| 451 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 452 |
|
| 453 |
@parametrize |
| 454 |
async def test_streaming_response_archive(self, async_client: AsyncAnthropic) -> None: |
| 455 |
async with async_client.beta.tunnels.certificates.with_streaming_response.archive( |
| 456 |
certificate_id="certificate_id", |
| 457 |
tunnel_id="tunnel_id", |
| 458 |
) as response: |
| 459 |
assert not response.is_closed |
| 460 |
assert response.http_request.headers.get("X-Stainless-Lang") == "python" |
| 461 |
|
| 462 |
certificate = await response.parse() |
| 463 |
assert_matches_type(BetaTunnelCertificate, certificate, path=["response"]) |
| 464 |
|
| 465 |
assert cast(Any, response.is_closed) is True |
| 466 |
|
| 467 |
@parametrize |
| 468 |
async def test_path_params_archive(self, async_client: AsyncAnthropic) -> None: |
| 469 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `tunnel_id` but received ''"): |
| 470 |
await async_client.beta.tunnels.certificates.with_raw_response.archive( |
| 471 |
certificate_id="certificate_id", |
| 472 |
tunnel_id="", |
| 473 |
) |
| 474 |
|
| 475 |
with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): |
| 476 |
await async_client.beta.tunnels.certificates.with_raw_response.archive( |
| 477 |
certificate_id="", |
| 478 |
tunnel_id="tunnel_id", |
| 479 |
) |