Search Options

Results per page
Sort
Preferred Languages
Advance

Results 121 - 130 of 1,157 for cassert (0.05 sec)

  1. tests/test_tutorial/test_generate_clients/test_tutorial003.py

    1. response = client.post("/items/", json={"name": "Foo", "price": 5})
    2. assert response.status_code == 200, response.text
    3. assert response.json() == {"message": "Item received"}
    4.  
    5.  
    6. def test_post_users():
    7. response = client.post(
    8. "/users/", json={"username": "Foo", "email": "******@****.***"}
    9. )
    10. assert response.status_code == 200, response.text
    11. assert response.json() == {"message": "User received"}
    12.  
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 7.1K bytes
    - Viewed (0)
  2. tests/test_security_api_key_query.py

    1.  
    2. def test_security_api_key():
    3. response = client.get("/users/me?key=secret")
    4. assert response.status_code == 200, response.text
    5. assert response.json() == {"username": "secret"}
    6.  
    7.  
    8. def test_security_api_key_no_key():
    9. response = client.get("/users/me")
    10. assert response.status_code == 403, response.text
    11. assert response.json() == {"detail": "Not authenticated"}
    12.  
    13.  
    14. def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  3. tests/test_security_http_base_description.py

    1. response = client.get("/users/me", headers={"Authorization": "Other foobar"})
    2. assert response.status_code == 200, response.text
    3. assert response.json() == {"scheme": "Other", "credentials": "foobar"}
    4.  
    5.  
    6. def test_security_http_base_no_credentials():
    7. response = client.get("/users/me")
    8. assert response.status_code == 403, response.text
    9. assert response.json() == {"detail": "Not authenticated"}
    10.  
    11.  
    12. def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_form_models/test_tutorial002_pv1_an_p39.py

    1. @needs_pydanticv1
    2. @needs_py39
    3. def test_post_body_form(client: TestClient):
    4. response = client.post("/login/", data={"username": "Foo", "password": "secret"})
    5. assert response.status_code == 200
    6. assert response.json() == {"username": "Foo", "password": "secret"}
    7.  
    8.  
    9. # TODO: remove when deprecating Pydantic v1
    10. @needs_pydanticv1
    11. @needs_py39
    12. def test_post_body_extra_form(client: TestClient):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 17:31:18 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  5. tests/test_regex_deprecated_body.py

    1. def test_no_query():
    2. client = get_client()
    3. response = client.post("/items/")
    4. assert response.status_code == 200
    5. assert response.json() == "Hello World"
    6.  
    7.  
    8. @needs_py310
    9. def test_q_fixedquery():
    10. client = get_client()
    11. response = client.post("/items/", data={"q": "fixedquery"})
    12. assert response.status_code == 200
    13. assert response.json() == "Hello fixedquery"
    14.  
    15.  
    16. @needs_py310
    17. def test_query_nonregexquery():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_query_params_str_validations/test_tutorial014.py

    1.  
    2. def test_hidden_query():
    3. response = client.get("/items?hidden_query=somevalue")
    4. assert response.status_code == 200, response.text
    5. assert response.json() == {"hidden_query": "somevalue"}
    6.  
    7.  
    8. def test_no_hidden_query():
    9. response = client.get("/items")
    10. assert response.status_code == 200, response.text
    11. assert response.json() == {"hidden_query": "Not found"}
    12.  
    13.  
    14. def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.9K bytes
    - Viewed (0)
  7. docs_src/dependency_testing/tutorial001_py310.py

    1. def test_override_in_items():
    2. response = client.get("/items/")
    3. assert response.status_code == 200
    4. assert response.json() == {
    5. "message": "Hello Items!",
    6. "params": {"q": None, "skip": 5, "limit": 10},
    7. }
    8.  
    9.  
    10. def test_override_in_items_with_q():
    11. response = client.get("/items/?q=foo")
    12. assert response.status_code == 200
    13. assert response.json() == {
    14. "message": "Hello Items!",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  8. tests/test_security_api_key_header.py

    1. def test_security_api_key():
    2. response = client.get("/users/me", headers={"key": "secret"})
    3. assert response.status_code == 200, response.text
    4. assert response.json() == {"username": "secret"}
    5.  
    6.  
    7. def test_security_api_key_no_key():
    8. response = client.get("/users/me")
    9. assert response.status_code == 403, response.text
    10. assert response.json() == {"detail": "Not authenticated"}
    11.  
    12.  
    13. def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial001_an_py39.py

    1. assert response.status_code == 401, response.text
    2. assert response.json() == {"detail": "Not authenticated"}
    3. assert response.headers["WWW-Authenticate"] == "Bearer"
    4.  
    5.  
    6. @needs_py39
    7. def test_openapi_schema(client: TestClient):
    8. response = client.get("/openapi.json")
    9. assert response.status_code == 200, response.text
    10. assert response.json() == {
    11. "openapi": "3.1.0",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  10. tests/test_security_api_key_header_description.py

    1. def test_security_api_key():
    2. response = client.get("/users/me", headers={"key": "secret"})
    3. assert response.status_code == 200, response.text
    4. assert response.json() == {"username": "secret"}
    5.  
    6.  
    7. def test_security_api_key_no_key():
    8. response = client.get("/users/me")
    9. assert response.status_code == 403, response.text
    10. assert response.json() == {"detail": "Not authenticated"}
    11.  
    12.  
    13. def test_openapi_schema():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2K bytes
    - Viewed (0)
Back to top