nixos/tests/grist: test file import

Covers both import failures from #568407: the missing plugins/ directory
and the unreadable upload inside the rootless gVisor sandbox.

Fixes #568407.
This commit is contained in:
tioan
2026-10-01 21:11:37 +02:00
parent 42ba894416
commit 4eab0d6ef9

View File

@@ -103,5 +103,19 @@ in
record = check_answer(r)["records"][0]
if record["fields"]["result"] != record["fields"]["number"] * 2:
sys.exit(1)
# Importing a file needs the built-in parsers registered in plugins/ and a
# gVisor sandbox that can read the upload.
with subtest("Import a CSV file"):
r = requests.post(
f"{url}docs",
files={"upload": ("import.csv", "name,value\nfoo,1\nbar,2\n")},
headers={"X-Requested-With": "XMLHttpRequest"},
)
import_doc_id = check_answer(r)
r = requests.get(f"{url}docs/{import_doc_id}/tables/Import/records")
names = [rec["fields"]["name"] for rec in check_answer(r)["records"]]
if names != ["foo", "bar"]:
sys.exit(1)
'';
}