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