Missing half of last commit fefb0db8ae

This commit is contained in:
Simon Willison 2018-05-28 13:42:48 -07:00
commit 27c10f6482
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
2 changed files with 17 additions and 12 deletions

View file

@ -17,7 +17,8 @@ def app_client(sql_time_limit_ms=None, max_returned_rows=None, config=None):
os.chdir(os.path.dirname(filepath)) os.chdir(os.path.dirname(filepath))
plugins_dir = os.path.join(tmpdir, 'plugins') plugins_dir = os.path.join(tmpdir, 'plugins')
os.mkdir(plugins_dir) os.mkdir(plugins_dir)
open(os.path.join(plugins_dir, 'my_plugin.py'), 'w').write(PLUGIN) open(os.path.join(plugins_dir, 'my_plugin.py'), 'w').write(PLUGIN1)
open(os.path.join(plugins_dir, 'my_plugin_2.py'), 'w').write(PLUGIN2)
config = config or {} config = config or {}
config.update({ config.update({
'default_page_size': 50, 'default_page_size': 50,
@ -114,7 +115,7 @@ METADATA = {
} }
} }
PLUGIN = ''' PLUGIN1 = '''
from datasette import hookimpl from datasette import hookimpl
import pint import pint
@ -137,9 +138,21 @@ def extra_css_urls():
@hookimpl @hookimpl
def extra_js_urls(): def extra_js_urls():
return [{ return [{
'url': 'https://example.com/app.js', 'url': 'https://example.com/jquery.js',
'sri': 'SRIHASH', 'sri': 'SRIHASH',
}] }, 'https://example.com/plugin1.js']
'''
PLUGIN2 = '''
from datasette import hookimpl
@hookimpl
def extra_js_urls():
return [{
'url': 'https://example.com/jquery.js',
'sri': 'SRIHASH',
}, 'https://example.com/plugin2.js']
''' '''
TABLES = ''' TABLES = '''

View file

@ -868,14 +868,6 @@ def test_unit_filters(app_client):
assert data['rows'][0][0] == 2 assert data['rows'][0][0] == 2
def test_plugins_dir_plugin(app_client):
response = app_client.get(
"/test_tables.json?sql=select+convert_units(100%2C+'m'%2C+'ft')",
gather_request=False
)
assert pytest.approx(328.0839) == response.json['rows'][0][0]
def test_metadata_json(app_client): def test_metadata_json(app_client):
response = app_client.get( response = app_client.get(
"/-/metadata.json", "/-/metadata.json",