Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for test_put (0.2 sec)

  1. tests/test_put_no_body.py

    @app.put("/items/{item_id}")
    def save_item_no_body(item_id: str):
        return {"item_id": item_id}
    
    
    client = TestClient(app)
    
    
    def test_put_no_body():
        response = client.put("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "foo"}
    
    
    def test_put_no_body_with_body():
        response = client.put("/items/foo", json={"name": "Foo"})
        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
    - 3.3K bytes
    - Viewed (0)
  2. tests/test_multi_body_errors.py

        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: List[Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_put_correct_body():
        response = client.post("/items/", json=[{"name": "Foo", "age": 5}])
        assert response.status_code == 200, response.text
        assert response.json() == {
            "item": [
                {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_bigger_applications/test_main_an.py

                    },
                ]
            }
        )
    
    
    def test_put_invalid_header(client: TestClient):
        response = client.put("/items/foo", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_put(client: TestClient):
        response = client.put(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_bigger_applications/test_main_an_py39.py

                ]
            }
        )
    
    
    @needs_py39
    def test_put_invalid_header(client: TestClient):
        response = client.put("/items/foo", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    @needs_py39
    def test_put(client: TestClient):
        response = client.put(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_bigger_applications/test_main.py

                    },
                ]
            }
        )
    
    
    def test_put_invalid_header(client: TestClient):
        response = client.put("/items/foo", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_put(client: TestClient):
        response = client.put(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_body_updates/test_tutorial001_py39.py

        assert response.json() == {
            "name": "Baz",
            "description": None,
            "price": 50.2,
            "tax": 10.5,
            "tags": [],
        }
    
    
    @needs_py39
    def test_put(client: TestClient):
        response = client.put(
            "/items/bar", json={"name": "Barz", "price": 3, "description": None}
        )
        assert response.json() == {
            "name": "Barz",
            "description": None,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body_updates/test_tutorial001.py

        assert response.json() == {
            "name": "Baz",
            "description": None,
            "price": 50.2,
            "tax": 10.5,
            "tags": [],
        }
    
    
    def test_put(client: TestClient):
        response = client.put(
            "/items/bar", json={"name": "Barz", "price": 3, "description": None}
        )
        assert response.json() == {
            "name": "Barz",
            "description": None,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_body_updates/test_tutorial001_py310.py

        assert response.json() == {
            "name": "Baz",
            "description": None,
            "price": 50.2,
            "tax": 10.5,
            "tags": [],
        }
    
    
    @needs_py310
    def test_put(client: TestClient):
        response = client.put(
            "/items/bar", json={"name": "Barz", "price": 3, "description": None}
        )
        assert response.json() == {
            "name": "Barz",
            "description": None,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  9. android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java

      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      @CollectionSize.Require(absent = ZERO)
      public void testPut_supportedPresent() {
        assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
        expectReplacement(entry(k0(), v3()));
      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      public void testPut_supportedNotPresent() {
        assertNull("put(notPresent, value) should return null", put(e3()));
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 21 16:49:06 GMT 2024
    - 9.4K bytes
    - Viewed (0)
  10. guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java

      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      @CollectionSize.Require(absent = ZERO)
      public void testPut_supportedPresent() {
        assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
        expectReplacement(entry(k0(), v3()));
      }
    
      @MapFeature.Require(SUPPORTS_PUT)
      public void testPut_supportedNotPresent() {
        assertNull("put(notPresent, value) should return null", put(e3()));
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 21 16:49:06 GMT 2024
    - 9.4K bytes
    - Viewed (0)
Back to top