mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Better tests for prepare_connection() plugin hook, refs #678
This commit is contained in:
parent
6303ea5048
commit
7c6a9c3529
2 changed files with 16 additions and 2 deletions
|
|
@ -10,13 +10,22 @@ import pytest
|
|||
import urllib
|
||||
|
||||
|
||||
def test_plugins_dir_plugin(app_client):
|
||||
def test_plugins_dir_plugin_prepare_connection(app_client):
|
||||
response = app_client.get(
|
||||
"/fixtures.json?sql=select+convert_units(100%2C+'m'%2C+'ft')"
|
||||
)
|
||||
assert pytest.approx(328.0839) == response.json["rows"][0][0]
|
||||
|
||||
|
||||
def test_plugin_prepare_connection_arguments(app_client):
|
||||
response = app_client.get(
|
||||
"/fixtures.json?sql=select+prepare_connection_args()&_shape=arrayfirst"
|
||||
)
|
||||
assert [
|
||||
"database=fixtures, datasette.plugin_config(\"name-of-plugin\")={'depth': 'root'}"
|
||||
] == response.json
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path,expected_decoded_object",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue