mirror of https://github.com/tiangolo/fastapi.git
[14350] Handling missing use-case in tests
This commit is contained in:
parent
36fa7ac2ab
commit
747c9df148
|
|
@ -23,10 +23,7 @@ class Task(TaskBase):
|
|||
|
||||
class CassandraConnection:
|
||||
def __init__(self, hosts=None, port=9042):
|
||||
if hosts is None:
|
||||
hosts = ["cassandra"]
|
||||
|
||||
self.cluster = Cluster(hosts, port=port)
|
||||
self.cluster = Cluster(hosts or ["cassandra"], port=port)
|
||||
self.session = None
|
||||
self.keyspace = "task_manager"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ class Task(TaskBase):
|
|||
|
||||
class ScyllaDBConnection:
|
||||
def __init__(self, hosts=None, port=9042):
|
||||
if hosts is None:
|
||||
hosts = ["scylladb"]
|
||||
|
||||
self.cluster = Cluster(hosts, port=port)
|
||||
self.cluster = Cluster(hosts or ["scylladb"], port=port)
|
||||
self.session = None
|
||||
self.keyspace = "task_manager"
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,17 @@ def test_crud_app(client: TestClient):
|
|||
assert response.status_code == 404, response.text
|
||||
assert response.json() == snapshot({"detail": "Task not found"})
|
||||
|
||||
response = client.put(
|
||||
f"/tasks/{task_id}",
|
||||
json={
|
||||
"title": "Updated non-existent task",
|
||||
"description": "This should fail",
|
||||
"status": "pending",
|
||||
},
|
||||
)
|
||||
assert response.status_code == 404, response.text
|
||||
assert response.json() == snapshot({"detail": "Task not found"})
|
||||
|
||||
|
||||
def test_openapi_schema(client: TestClient):
|
||||
response = client.get("/openapi.json")
|
||||
|
|
|
|||
Loading…
Reference in New Issue