- Sort Score
- Result 10 results
- Languages All
Results 181 - 190 of 511 for testClient2 (0.06 sec)
-
tests/test_response_model_data_filter_no_inheritance.py
from typing import List from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class UserCreate(BaseModel): email: str password: str class UserDB(BaseModel): email: str hashed_password: str class User(BaseModel): email: str class PetDB(BaseModel): name: str owner: UserDB
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.7K bytes - Viewed (0) -
tests/test_tutorial/test_handling_errors/test_tutorial002.py
from fastapi.testclient import TestClient from docs_src.handling_errors.tutorial002 import app client = TestClient(app) def test_get_item_header(): response = client.get("/items-header/foo") assert response.status_code == 200, response.text assert response.json() == {"item": "The Foo Wrestlers"} def test_get_item_not_found_header(): response = client.get("/items-header/bar")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.3K bytes - Viewed (0) -
docs/pt/docs/advanced/async-tests.md
O `TestClient` faz algumas mágicas para invocar a aplicação FastAPI assíncrona em suas funções `def` normais, utilizando o pytest padrão. Porém a mágica não acontece mais quando nós estamos utilizando dentro de funções assíncronas. Ao executar os nossos testes de forma assíncrona, nós não podemos mais utilizar o `TestClient` dentro das nossas funções de teste.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 4.4K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001_an_py39.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from ...utils import needs_py39 @needs_py39 @pytest.mark.parametrize( "path,cookies,expected_status,expected_response", [ ("/items", None, 200, {"ads_id": None}), ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}), ( "/items", {"ads_id": "ads_track", "session": "cookiesession"},
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.1K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial001_an_py39.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.dependencies.tutorial001_an_py39 import app client = TestClient(app) return client @needs_py39 @pytest.mark.parametrize( "path,expected_status,expected_response", [
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 7.2K bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial009b.py
from pathlib import Path from fastapi.testclient import TestClient from docs_src.custom_response import tutorial009b from docs_src.custom_response.tutorial009b import app client = TestClient(app) def test_get(tmp_path: Path): file_path: Path = tmp_path / "large-video-file.mp4" tutorial009b.some_file_path = str(file_path) test_content = b"Fake video bytes" file_path.write_bytes(test_content)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jul 03 19:51:28 UTC 2021 - 490 bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial009c.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 01 09:32:30 UTC 2022 - 239 bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.path_operation_advanced_configuration.tutorial003 import app client = TestClient(app) def test_get(): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [{"item_id": "Foo"}] def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 575 bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial007.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 264 bytes - Viewed (0) -
tests/test_orjson_response_class.py
from fastapi.responses import ORJSONResponse from fastapi.testclient import TestClient from sqlalchemy.sql.elements import quoted_name app = FastAPI(default_response_class=ORJSONResponse) @app.get("/orjson_non_str_keys") def get_orjson_non_str_keys(): key = quoted_name(value="msg", quote=False) return {key: "Hello World", 1: 1} client = TestClient(app) def test_orjson_non_str_keys(): with client:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Sep 02 10:17:31 UTC 2022 - 562 bytes - Viewed (0)