Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 302 for Dost (0.21 sec)

  1. tests/test_tutorial/test_request_files/test_tutorial001_02_an_py39.py

        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "No file sent"}
    
    
    @needs_py39
    def test_post_uploadfile_no_body(client: TestClient):
        response = client.post("/uploadfile/")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.5K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_request_files/test_tutorial002_an.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial002_an import app
    
    client = TestClient(app)
    
    
    def test_post_form_no_body():
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.5K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_request_files/test_tutorial003_an.py

    client = TestClient(app)
    
    
    def test_post_files(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
        path2.write_bytes(b"<file content2>")
    
        client = TestClient(app)
        with path.open("rb") as file, path2.open("rb") as file2:
            response = client.post(
                "/files/",
                files=(
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py

        return app
    
    
    @pytest.fixture(name="client")
    def get_client(app: FastAPI):
        client = TestClient(app)
        return client
    
    
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_body_nested_models/test_tutorial009.py

        return client
    
    
    def test_post_body(client: TestClient):
        data = {"2": 2.2, "3": 3.3}
        response = client.post("/index-weights/", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == data
    
    
    def test_post_invalid_body(client: TestClient):
        data = {"foo": 2.2, "3": 3.3}
        response = client.post("/index-weights/", json=data)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  6. tests/test_security_oauth2.py

                        "summary": "Login",
                        "operationId": "login_login_post",
                        "requestBody": {
                            "content": {
                                "application/x-www-form-urlencoded": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_login_login_post"
                                    }
                                }
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  7. docs_src/request_files/tutorial003_an_py39.py

    from fastapi import FastAPI, File, UploadFile
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(
        files: Annotated[list[bytes], File(description="Multiple files as bytes")],
    ):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(
        files: Annotated[
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 952 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_security/test_tutorial003_an_py310.py

    @needs_py310
    def test_login(client: TestClient):
        response = client.post("/token", data={"username": "johndoe", "password": "secret"})
        assert response.status_code == 200, response.text
        assert response.json() == {"access_token": "johndoe", "token_type": "bearer"}
    
    
    @needs_py310
    def test_login_incorrect_password(client: TestClient):
        response = client.post(
            "/token", data={"username": "johndoe", "password": "incorrect"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.4K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial003_py310.py

    @needs_py310
    def test_login(client: TestClient):
        response = client.post("/token", data={"username": "johndoe", "password": "secret"})
        assert response.status_code == 200, response.text
        assert response.json() == {"access_token": "johndoe", "token_type": "bearer"}
    
    
    @needs_py310
    def test_login_incorrect_password(client: TestClient):
        response = client.post(
            "/token", data={"username": "johndoe", "password": "incorrect"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.4K bytes
    - Viewed (0)
  10. tests/test_required_noneable.py

    def test_required_nonable_body_embed_no_content():
        response = client.post("/body-embed")
        assert response.status_code == 422
    
    
    def test_required_nonable_body_embed_invalid():
        response = client.post("/body-embed", json={"invalid": "invalid"})
        assert response.status_code == 422
    
    
    def test_required_noneable_body_embed_value():
        response = client.post("/body-embed", json={"b": "foo"})
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 19:08:31 GMT 2022
    - 1.5K bytes
    - Viewed (0)
Back to top