mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix bug where -s could reset settings to defaults, closes #2389
This commit is contained in:
parent
f6bd2bf8b0
commit
bf953628bb
4 changed files with 70 additions and 1 deletions
|
|
@ -240,6 +240,31 @@ def test_setting(args):
|
|||
assert settings["default_page_size"] == 5
|
||||
|
||||
|
||||
def test_setting_compatible_with_config(tmp_path):
|
||||
# https://github.com/simonw/datasette/issues/2389
|
||||
runner = CliRunner()
|
||||
config_path = tmp_path / "config.json"
|
||||
config_path.write_text(
|
||||
'{"settings": {"default_page_size": 5, "sql_time_limit_ms": 50}}', "utf-8"
|
||||
)
|
||||
result = runner.invoke(
|
||||
cli,
|
||||
[
|
||||
"--get",
|
||||
"/-/settings.json",
|
||||
"--config",
|
||||
str(config_path),
|
||||
"--setting",
|
||||
"default_page_size",
|
||||
"10",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
settings = json.loads(result.output)
|
||||
assert settings["default_page_size"] == 10
|
||||
assert settings["sql_time_limit_ms"] == 50
|
||||
|
||||
|
||||
def test_plugin_s_overwrite():
|
||||
runner = CliRunner()
|
||||
plugins_dir = str(pathlib.Path(__file__).parent / "plugins")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue