Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for test_0 (0.29 sec)

  1. tests/test_tutorial/test_custom_response/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert response.text == "Hello World"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 980 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_response_model/test_tutorial005.py

    from docs_src.response_model.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_read_item_name():
        response = client.get("/items/bar/name")
        assert response.status_code == 200, response.text
        assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
    
    
    def test_read_item_public_data():
        response = client.get("/items/bar/public")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_path_operation_configurations/test_tutorial005.py

    client = TestClient(app)
    
    
    def test_query_params_str_validations():
        response = client.post("/items/", json={"name": "Foo", "price": 42})
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "Foo",
            "price": 42,
            "description": None,
            "tax": None,
            "tags": [],
        }
    
    
    @needs_pydanticv2
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 8.7K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_schema_extra_example/test_tutorial005.py

        client = TestClient(app)
        return client
    
    
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
                "description": "A very nice Item",
                "price": 35.4,
                "tax": 3.2,
            },
        )
        assert response.status_code == 200
    
    
    def test_openapi_schema(client: TestClient) -> None:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 26 18:03:13 GMT 2023
    - 6.7K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_security/test_tutorial005.py

    
    def test_verify_password():
        assert verify_password("secret", fake_users_db["johndoe"]["hashed_password"])
    
    
    def test_get_password_hash():
        assert get_password_hash("secretalice")
    
    
    def test_create_access_token():
        access_token = create_access_token(data={"data": "foo"})
        assert access_token
    
    
    def test_token_no_sub():
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 15.4K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_path_params/test_tutorial005.py

    from docs_src.path_params.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get_enums_alexnet():
        response = client.get("/models/alexnet")
        assert response.status_code == 200
        assert response.json() == {"model_name": "alexnet", "message": "Deep Learning FTW!"}
    
    
    def test_get_enums_lenet():
        response = client.get("/models/lenet")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 5K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_query_params/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.query_params.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_foo_needy_very():
        response = client.get("/items/foo?needy=very")
        assert response.status_code == 200
        assert response.json() == {"item_id": "foo", "needy": "very"}
    
    
    def test_foo_no_needy():
        response = client.get("/items/foo")
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.path_operation_advanced_configuration.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_extra_models/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.extra_models.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_get_items():
        response = client.get("/keyword-weights/")
        assert response.status_code == 200, response.text
        assert response.json() == {"foo": 2.3, "bar": 3.4}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_handling_errors/test_tutorial005.py

                ],
                "body": {"title": "towel", "size": "XL"},
            }
        )
    
    
    def test_post():
        data = {"title": "towel", "size": 5}
        response = client.post("/items/", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == data
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 4.3K bytes
    - Viewed (0)
Back to top