Search Options

Results per page
Sort
Preferred Languages
Advance

Results 261 - 270 of 1,036 for AssertJ (0.12 sec)

  1. tests/test_tutorial/test_advanced_middleware/test_tutorial003.py

    def test_middleware():
        response = client.get("/large", headers={"accept-encoding": "gzip"})
        assert response.status_code == 200, response.text
        assert response.text == "x" * 4000
        assert response.headers["Content-Encoding"] == "gzip"
        assert int(response.headers["Content-Length"]) < 4000
        response = client.get("/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jul 09 18:06:12 UTC 2020
    - 665 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_query_params_str_validations/test_tutorial011.py

    def test_multi_query_values():
        url = "/items/?q=foo&q=bar"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    def test_query_no_values():
        url = "/items/"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": None}
    
    
    def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_request_files/test_tutorial003_an_py39.py

                ),
            )
        assert response.status_code == 200, response.text
        assert response.json() == {"filenames": ["test.txt", "test2.txt"]}
    
    
    @needs_py39
    def test_get_root(app: FastAPI):
        client = TestClient(app)
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<form" in response.content
    
    
    @needs_py39
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 7.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_form_models/test_tutorial002_an_py39.py

        assert response.status_code == 200
        assert response.json() == {"username": "Foo", "password": "secret"}
    
    
    @needs_pydanticv2
    @needs_py39
    def test_post_body_extra_form(client: TestClient):
        response = client.post(
            "/login/", data={"username": "Foo", "password": "secret", "extra": "extra"}
        )
        assert response.status_code == 422
        assert response.json() == {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 17:31:18 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  5. tests/test_multi_query_errors.py

    client = TestClient(app)
    
    
    def test_multi_query():
        response = client.get("/items/?q=5&q=6")
        assert response.status_code == 200, response.text
        assert response.json() == {"q": [5, 6]}
    
    
    def test_multi_query_incorrect():
        response = client.get("/items/?q=five&q=six")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_extra_models/test_tutorial003.py

    def test_get_car():
        response = client.get("/items/item1")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "description": "All my friends drive a low rider",
            "type": "car",
        }
    
    
    def test_get_plane():
        response = client.get("/items/item2")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 04 20:47:07 UTC 2023
    - 5.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_query_params_str_validations/test_tutorial012_an_py39.py

        url = "/items/"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    @needs_py39
    def test_multi_query_values(client: TestClient):
        url = "/items/?q=baz&q=foobar"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["baz", "foobar"]}
    
    
    @needs_py39
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_templates/test_tutorial001.py

        client = TestClient(app)
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert (
            b'<h1><a href="http://testserver/items/foo">Item ID: foo</a></h1>'
            in response.content
        )
        response = client.get("/static/styles.css")
        assert response.status_code == 200, response.text
        assert b"color: green;" in response.content
        shutil.rmtree("./templates")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jan 11 22:25:37 UTC 2024
    - 910 bytes
    - Viewed (0)
  9. tests/test_response_model_sub_types.py

    
    def test_path_operations():
        response = client.get("/valid1")
        assert response.status_code == 200, response.text
        response = client.get("/valid2")
        assert response.status_code == 200, response.text
        response = client.get("/valid3")
        assert response.status_code == 200, response.text
        response = client.get("/valid4")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 5.3K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_request_files/test_tutorial001_03_an_py39.py

        assert response.status_code == 200, response.text
        assert response.json() == {"file_size": 14}
    
    
    @needs_py39
    def test_post_upload_file(tmp_path, client: TestClient):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        with path.open("rb") as file:
            response = client.post("/uploadfile/", files={"file": file})
        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
    - 6.2K bytes
    - Viewed (0)
Back to top