Cookie strings that are against the RFC6265 spec but which browsers will send if set via document.cookie.
(
set_cookie: str,
expected: dict[str, str],
test_client_factory: TestClientFactory,
)
| 452 | ], |
| 453 | ) |
| 454 | def test_cookies_invalid( |
| 455 | set_cookie: str, |
| 456 | expected: dict[str, str], |
| 457 | test_client_factory: TestClientFactory, |
| 458 | ) -> None: |
| 459 | class="st">""" |
| 460 | Cookie strings that are against the RFC6265 spec but which browsers will send if set |
| 461 | via document.cookie. |
| 462 | class="st">""" |
| 463 | |
| 464 | async def app(scope: Scope, receive: Receive, send: Send) -> None: |
| 465 | request = Request(scope, receive) |
| 466 | response = JSONResponse({class="st">"cookies": request.cookies}) |
| 467 | await response(scope, receive, send) |
| 468 | |
| 469 | client = test_client_factory(app) |
| 470 | response = client.get(class="st">"/", headers={class="st">"cookie": set_cookie}) |
| 471 | result = response.json() |
| 472 | assert result[class="st">"cookies"] == expected |
| 473 | |
| 474 | |
| 475 | def test_multiple_cookie_headers(test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected