'datasette --get' option, closes #926

Also made a start on the datasette.utils.testing module, refs #898
This commit is contained in:
Simon Willison 2020-08-11 17:24:40 -07:00 committed by GitHub
commit e139a7619f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 242 additions and 160 deletions

View file

@ -50,6 +50,20 @@ def test_serve_with_inspect_file_prepopulates_table_counts_cache():
assert {"hithere": 44} == db.cached_table_counts
def test_serve_with_get():
runner = CliRunner()
result = runner.invoke(
cli,
["serve", "--memory", "--get", "/:memory:.json?sql=select+sqlite_version()"],
)
assert 0 == result.exit_code, result.output
assert {
"database": ":memory:",
"truncated": False,
"columns": ["sqlite_version()"],
}.items() <= json.loads(result.output).items()
def test_spatialite_error_if_attempt_to_open_spatialite():
runner = CliRunner()
result = runner.invoke(
@ -102,6 +116,7 @@ def test_metadata_yaml():
secret=None,
root=False,
version_note=None,
get=None,
help_config=False,
return_instance=True,
)