Fixes for test_generated_columns_are_visible_in_datasette, refs #1391

This commit is contained in:
Simon Willison 2021-07-10 12:14:14 -07:00
commit e0064ba7b0

View file

@ -2067,17 +2067,16 @@ def test_generated_columns_are_visible_in_datasette():
id INT GENERATED ALWAYS AS (json_extract(body, '$.number')) STORED, id INT GENERATED ALWAYS AS (json_extract(body, '$.number')) STORED,
consideration INT GENERATED ALWAYS AS (json_extract(body, '$.string')) STORED consideration INT GENERATED ALWAYS AS (json_extract(body, '$.string')) STORED
); );
INSERT INTO generated_columns (body) VALUES ('{ INSERT INTO generated_columns (body) VALUES (
"number": 1, '{"number": 1, "string": "This is a string"}'
"string": "This is a string" );"""
}');"""
} }
) as client: ) as client:
response = app_client.get("/generated/generated_columns.json?_shape=array") response = client.get("/generated/generated_columns.json?_shape=array")
assert response.json == [ assert response.json == [
{ {
"rowid": 1, "rowid": 1,
"body": '{\n "number": 1,\n "string": "This is a string"\n}', "body": '{"number": 1, "string": "This is a string"}',
"id": 1, "id": 1,
"consideration": "This is a string", "consideration": "This is a string",
} }