mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Trace write SQL queries in addition to read ones, closes #1568
This commit is contained in:
parent
7c8f8aa209
commit
f81d9d0cd9
2 changed files with 16 additions and 1 deletions
|
|
@ -939,6 +939,19 @@ def test_trace(trace_debug):
|
|||
assert isinstance(trace["sql"], str)
|
||||
assert isinstance(trace["params"], (list, dict, None.__class__))
|
||||
|
||||
sqls = [trace["sql"] for trace in trace_info["traces"] if "sql" in trace]
|
||||
# There should be a mix of different types of SQL statement
|
||||
expected = (
|
||||
"CREATE TABLE ",
|
||||
"PRAGMA ",
|
||||
"INSERT OR REPLACE INTO ",
|
||||
"DELETE FROM ",
|
||||
"INSERT INTO",
|
||||
"select ",
|
||||
)
|
||||
for prefix in expected:
|
||||
assert any(sql.startswith(prefix) for sql in sqls)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path,status_code",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue