Browse Source

[14350] Handling missing use-case in tests

pull/14352/head
Andrii Kysylevskyi 8 months ago
parent
commit
747c9df148
  1. 5
      docs_src/nosql_databases/tutorial001.py
  2. 5
      docs_src/nosql_databases/tutorial001_scylla.py
  3. 11
      tests/test_tutorial/test_nosql_databases/test_tutorial001.py

5
docs_src/nosql_databases/tutorial001.py

@ -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"

5
docs_src/nosql_databases/tutorial001_scylla.py

@ -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"

11
tests/test_tutorial/test_nosql_databases/test_tutorial001.py

@ -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…
Cancel
Save