mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Plugin configuration now lives in datasette.yaml/json
* Checkpoint, moving top-level plugin config to datasette.json * Support database-level and table-level plugin configuration in datasette.yaml Refs #2093
This commit is contained in:
parent
a4c96d01b2
commit
b2ec8717c3
10 changed files with 217 additions and 54 deletions
|
|
@ -238,6 +238,44 @@ def test_setting(args):
|
|||
assert settings["default_page_size"] == 5
|
||||
|
||||
|
||||
def test_plugin_s_overwrite():
|
||||
runner = CliRunner()
|
||||
plugins_dir = str(pathlib.Path(__file__).parent / "plugins")
|
||||
|
||||
result = runner.invoke(
|
||||
cli,
|
||||
[
|
||||
"--plugins-dir",
|
||||
plugins_dir,
|
||||
"--get",
|
||||
"/_memory.json?sql=select+prepare_connection_args()",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert (
|
||||
json.loads(result.output).get("rows")[0].get("prepare_connection_args()")
|
||||
== 'database=_memory, datasette.plugin_config("name-of-plugin")=None'
|
||||
)
|
||||
|
||||
result = runner.invoke(
|
||||
cli,
|
||||
[
|
||||
"--plugins-dir",
|
||||
plugins_dir,
|
||||
"--get",
|
||||
"/_memory.json?sql=select+prepare_connection_args()",
|
||||
"-s",
|
||||
"plugins.name-of-plugin",
|
||||
"OVERRIDE",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert (
|
||||
json.loads(result.output).get("rows")[0].get("prepare_connection_args()")
|
||||
== 'database=_memory, datasette.plugin_config("name-of-plugin")=OVERRIDE'
|
||||
)
|
||||
|
||||
|
||||
def test_setting_type_validation():
|
||||
runner = CliRunner(mix_stderr=False)
|
||||
result = runner.invoke(cli, ["--setting", "default_page_size", "dog"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue