mirror of
https://github.com/simonw/datasette.git
synced 2026-10-22 01:07:03 +02:00
Merge ac5954bd31 into c435a80030
This commit is contained in:
commit
18a45ca8dd
3 changed files with 44 additions and 2 deletions
|
|
@ -171,6 +171,7 @@ def test_metadata_yaml():
|
|||
nolock=False,
|
||||
open_browser=False,
|
||||
create=False,
|
||||
create_wal=False,
|
||||
ssl_keyfile=None,
|
||||
ssl_certfile=None,
|
||||
return_instance=True,
|
||||
|
|
@ -462,6 +463,37 @@ def test_serve_create(tmpdir):
|
|||
assert db_path.exists()
|
||||
|
||||
|
||||
def test_serve_create_wal(tmpdir):
|
||||
runner = CliRunner()
|
||||
db_path = tmpdir / "does_not_exist_yet.db"
|
||||
assert not db_path.exists()
|
||||
result = runner.invoke(
|
||||
cli, [str(db_path), "--create-wal", "--get", "/-/databases.json"]
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert db_path.exists()
|
||||
# The new database should be in WAL mode
|
||||
conn = sqlite3.connect(str(db_path))
|
||||
try:
|
||||
assert conn.execute("pragma journal_mode").fetchone()[0] == "wal"
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def test_serve_create_does_not_set_wal(tmpdir):
|
||||
runner = CliRunner()
|
||||
db_path = tmpdir / "does_not_exist_yet.db"
|
||||
result = runner.invoke(
|
||||
cli, [str(db_path), "--create", "--get", "/-/databases.json"]
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
conn = sqlite3.connect(str(db_path))
|
||||
try:
|
||||
assert conn.execute("pragma journal_mode").fetchone()[0] != "wal"
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("argument", ("-c", "--config"))
|
||||
@pytest.mark.parametrize("format_", ("json", "yaml"))
|
||||
def test_serve_config(tmpdir, argument, format_):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue