Ensure db.path is a string before trying to insert into internal database (#1370)

Thanks, @eyeseast
This commit is contained in:
Chris Amico 2021-06-21 11:57:38 -04:00 committed by GitHub
commit a6c55afe8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -25,6 +25,7 @@ from .fixtures import ( # noqa
METADATA,
)
import json
import pathlib
import pytest
import sys
import urllib
@ -2123,3 +2124,16 @@ def test_col_nocol_errors(app_client, path, expected_error):
response = app_client.get(path)
assert response.status == 400
assert response.json["error"] == expected_error
@pytest.mark.asyncio
async def test_db_path(app_client):
db = app_client.ds.get_database()
path = pathlib.Path(db.path)
assert path.exists()
datasette = Datasette([path])
# this will break with a path
await datasette.refresh_schemas()