Search Options

Results per page
Sort
Preferred Languages
Advance

Results 211 - 220 of 526 for RestClient (0.06 sec)

  1. docs/em/docs/advanced/testing-websockets.md

    # ๐Ÿ”ฌ *๏ธโƒฃ
    
    ๐Ÿ‘† ๐Ÿ’ช โš™๏ธ ๐ŸŽ `TestClient` ๐Ÿ’ฏ*๏ธโƒฃ.
    
    ๐Ÿ‘‰, ๐Ÿ‘† โš™๏ธ `TestClient` `with` ๐Ÿ“„, ๐Ÿ”—*๏ธโƒฃ:
    
    ```Python hl_lines="27-31"
    {!../../docs_src/app_testing/tutorial002.py!}
    ```
    
    /// note
    
    ๐ŸŒ… โ„น, โœ… ๐Ÿ’ƒ ๐Ÿงพ <a href="https://www.starlette.io/testclient/#testing-websocket-sessions" class="external-link" target="_blank">๐Ÿ”ฌ *๏ธโƒฃ </a>.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 371 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_response_cookies/test_tutorial002.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_cookies.tutorial002 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie-and-object/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jul 09 18:06:12 UTC 2020
    - 414 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_security/test_tutorial006_an_py39.py

    from base64 import b64encode
    
    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.security.tutorial006_an import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_security_http_basic(client: TestClient):
        response = client.get("/users/me", auth=("john", "secret"))
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_dependencies/test_tutorial008c_an.py

    import pytest
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008c_an import app
    
        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  5. docs/zh/docs/advanced/testing-websockets.md

    # ๆต‹่ฏ• WebSockets
    
    ๆต‹่ฏ• WebSockets ไนŸไฝฟ็”จ `TestClient`ใ€‚
    
    ไธบๆญค๏ผŒ่ฆๅœจ `with` ่ฏญๅฅไธญไฝฟ็”จ `TestClient` ่ฟžๆŽฅ WebSocketใ€‚
    
    ```Python hl_lines="27-31"
    {!../../docs_src/app_testing/tutorial002.py!}
    ```
    
    /// note | "็ฌ”่ฎฐ"
    
    ๆ›ดๅคš็ป†่Š‚่ฏฆ่ง <a href="https://www.starlette.io/testclient/#testing-websocket-sessions" class="external-link" target="_blank">Starlette ๅฎ˜ๆกฃ - ๆต‹่ฏ• WebSockets</a>ใ€‚
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 418 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_response/test_tutorial008.py

    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.custom_response import tutorial008
    from docs_src.custom_response.tutorial008 import app
    
    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial008.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
        response = client.get("/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jul 09 18:06:12 UTC 2020
    - 487 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_wsgi/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.wsgi.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_flask():
        response = client.get("/v1/")
        assert response.status_code == 200, response.text
        assert response.text == "Hello, World from Flask!"
    
    
    def test_app():
        response = client.get("/v2")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jul 09 18:06:12 UTC 2020
    - 436 bytes
    - Viewed (1)
  8. tests/test_tutorial/test_settings/test_tutorial001.py

    from fastapi.testclient import TestClient
    from pytest import MonkeyPatch
    
    from ...utils import needs_pydanticv2
    
    
    @needs_pydanticv2
    def test_settings(monkeypatch: MonkeyPatch):
        monkeypatch.setenv("ADMIN_EMAIL", "******@****.***")
        from docs_src.settings.tutorial001 import app
    
        client = TestClient(app)
        response = client.get("/info")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 552 bytes
    - Viewed (0)
  9. docs/em/docs/advanced/async-tests.md

    `TestClient` ๐Ÿ”จ ๐ŸŽฑ ๐Ÿ”˜ ๐Ÿค™ ๐Ÿ” FastAPI ๐Ÿˆธ ๐Ÿ‘† ๐Ÿ˜ `def` ๐Ÿ’ฏ ๐Ÿ”ข, โš™๏ธ ๐Ÿฉ โœณ. โœ‹๏ธ ๐Ÿ‘ˆ ๐ŸŽฑ ๐Ÿšซ ๐Ÿ‘ท ๐Ÿšซ๐Ÿ”œ ๐Ÿ•โ” ๐Ÿ‘ฅ โš™๏ธ โšซ๏ธ ๐Ÿ”˜ ๐Ÿ” ๐Ÿ”ข. ๐Ÿƒ ๐Ÿ‘† ๐Ÿ’ฏ ๐Ÿ”, ๐Ÿ‘ฅ ๐Ÿ’ช ๐Ÿ™…โ€โ™‚ ๐Ÿ“ โš™๏ธ `TestClient` ๐Ÿ”˜ ๐Ÿ‘† ๐Ÿ’ฏ ๐Ÿ”ข.
    
    `TestClient` โš“๏ธ ๐Ÿ”› <a href="https://www.python-httpx.org" class="external-link" target="_blank">๐Ÿ‡ธ๐Ÿ‡ฒ</a>, &amp; โ†ฉ๏ธ, ๐Ÿ‘ฅ ๐Ÿ’ช โš™๏ธ โšซ๏ธ ๐Ÿ”— ๐Ÿ’ฏ ๐Ÿ› ๏ธ.
    
    ## ๐Ÿ–ผ
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_dependencies/test_tutorial008d.py

    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.dependencies.tutorial008d import app
    
        client = TestClient(app)
        return client
    
    
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
        assert response.json() == {"detail": "Item not found, there's only a plumbus here"}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 1.2K bytes
    - Viewed (0)
Back to top