mirror of https://github.com/tiangolo/fastapi.git
📝 Update examples for tests to replace "inexistent" for "nonexistent" (#11220)
This commit is contained in:
parent
72e07c4f44
commit
478288700a
|
|
@ -21,7 +21,7 @@ def test_read_item_bad_token():
|
|||
assert response.json() == {"detail": "Invalid X-Token header"}
|
||||
|
||||
|
||||
def test_read_inexistent_item():
|
||||
def test_read_nonexistent_item():
|
||||
response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Item not found"}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def test_read_item_bad_token():
|
|||
assert response.json() == {"detail": "Invalid X-Token header"}
|
||||
|
||||
|
||||
def test_read_inexistent_item():
|
||||
def test_read_nonexistent_item():
|
||||
response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Item not found"}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def test_read_item_bad_token():
|
|||
assert response.json() == {"detail": "Invalid X-Token header"}
|
||||
|
||||
|
||||
def test_read_inexistent_item():
|
||||
def test_read_nonexistent_item():
|
||||
response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Item not found"}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def test_read_item_bad_token():
|
|||
assert response.json() == {"detail": "Invalid X-Token header"}
|
||||
|
||||
|
||||
def test_read_inexistent_item():
|
||||
def test_read_nonexistent_item():
|
||||
response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Item not found"}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def test_read_item_bad_token():
|
|||
assert response.json() == {"detail": "Invalid X-Token header"}
|
||||
|
||||
|
||||
def test_read_inexistent_item():
|
||||
def test_read_nonexistent_item():
|
||||
response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "Item not found"}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ def test_token_no_scope():
|
|||
assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'
|
||||
|
||||
|
||||
def test_token_inexistent_user():
|
||||
def test_token_nonexistent_user():
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ def test_token_no_scope():
|
|||
assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'
|
||||
|
||||
|
||||
def test_token_inexistent_user():
|
||||
def test_token_nonexistent_user():
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ def test_token_no_scope(client: TestClient):
|
|||
|
||||
|
||||
@needs_py310
|
||||
def test_token_inexistent_user(client: TestClient):
|
||||
def test_token_nonexistent_user(client: TestClient):
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ def test_token_no_scope(client: TestClient):
|
|||
|
||||
|
||||
@needs_py39
|
||||
def test_token_inexistent_user(client: TestClient):
|
||||
def test_token_nonexistent_user(client: TestClient):
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ def test_token_no_scope(client: TestClient):
|
|||
|
||||
|
||||
@needs_py310
|
||||
def test_token_inexistent_user(client: TestClient):
|
||||
def test_token_nonexistent_user(client: TestClient):
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ def test_token_no_scope(client: TestClient):
|
|||
|
||||
|
||||
@needs_py39
|
||||
def test_token_inexistent_user(client: TestClient):
|
||||
def test_token_nonexistent_user(client: TestClient):
|
||||
response = client.get(
|
||||
"/users/me",
|
||||
headers={
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ def test_get_user(client):
|
|||
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ def test_get_user(client):
|
|||
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def test_get_user(client):
|
|||
@needs_py310
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def test_get_user(client):
|
|||
@needs_py39
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ def test_get_user(client):
|
|||
@needs_py310
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ def test_get_user(client):
|
|||
@needs_py39
|
||||
# TODO: pv2 add version with Pydantic v2
|
||||
@needs_pydanticv1
|
||||
def test_inexistent_user(client):
|
||||
def test_nonexistent_user(client):
|
||||
response = client.get("/users/999")
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ def test_app():
|
|||
test_main.test_create_existing_item()
|
||||
test_main.test_create_item()
|
||||
test_main.test_create_item_bad_token()
|
||||
test_main.test_read_inexistent_item()
|
||||
test_main.test_read_nonexistent_item()
|
||||
test_main.test_read_item()
|
||||
test_main.test_read_item_bad_token()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ def test_app():
|
|||
test_main.test_create_existing_item()
|
||||
test_main.test_create_item()
|
||||
test_main.test_create_item_bad_token()
|
||||
test_main.test_read_inexistent_item()
|
||||
test_main.test_read_nonexistent_item()
|
||||
test_main.test_read_item()
|
||||
test_main.test_read_item_bad_token()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ def test_app():
|
|||
test_main.test_create_existing_item()
|
||||
test_main.test_create_item()
|
||||
test_main.test_create_item_bad_token()
|
||||
test_main.test_read_inexistent_item()
|
||||
test_main.test_read_nonexistent_item()
|
||||
test_main.test_read_item()
|
||||
test_main.test_read_item_bad_token()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ def test_app():
|
|||
test_main.test_create_existing_item()
|
||||
test_main.test_create_item()
|
||||
test_main.test_create_item_bad_token()
|
||||
test_main.test_read_inexistent_item()
|
||||
test_main.test_read_nonexistent_item()
|
||||
test_main.test_read_item()
|
||||
test_main.test_read_item_bad_token()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ def test_app():
|
|||
test_main.test_create_existing_item()
|
||||
test_main.test_create_item()
|
||||
test_main.test_create_item_bad_token()
|
||||
test_main.test_read_inexistent_item()
|
||||
test_main.test_read_nonexistent_item()
|
||||
test_main.test_read_item()
|
||||
test_main.test_read_item_bad_token()
|
||||
|
|
|
|||
Loading…
Reference in New Issue