(
app: ASGIApp,
expectation: AbstractContextManager[Exception],
test_client_factory: TestClientFactory,
)
| 687 | ], |
| 688 | ) |
| 689 | def test_too_many_fields_raise( |
| 690 | app: ASGIApp, |
| 691 | expectation: AbstractContextManager[Exception], |
| 692 | test_client_factory: TestClientFactory, |
| 693 | ) -> None: |
| 694 | client = test_client_factory(app) |
| 695 | fields = [] |
| 696 | for i in range(1001): |
| 697 | fields.append(f&class="cm">#x27;--B\r\nContent-Disposition: form-data; name=class="st">"N{i}";\r\n\r\n\r\n') |
| 698 | data = class="st">"".join(fields).encode(class="st">"utf-8") |
| 699 | with expectation: |
| 700 | res = client.post( |
| 701 | class="st">"/", |
| 702 | data=data, class="cm"># type: ignore |
| 703 | headers={class="st">"Content-Type": (class="st">"multipart/form-data; boundary=B")}, |
| 704 | ) |
| 705 | assert res.status_code == 400 |
| 706 | assert res.text == class="st">"Too many fields. Maximum number of fields is 1000." |
| 707 | |
| 708 | |
| 709 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected