Test for publish_subcommand hook, refs #773

pull/783/head
Simon Willison 2020-05-27 20:30:32 -07:00
rodzic cbeea23d00
commit defead17a4
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -7,6 +7,7 @@ from .fixtures import (
TestClient as _TestClient,
) # noqa
from datasette.app import Datasette
from datasette import cli
from datasette.plugins import get_plugins, DEFAULT_PLUGINS, pm
from datasette.utils import sqlite3
from jinja2.environment import Template
@ -418,3 +419,12 @@ async def test_prepare_jinja2_environment(app_client):
)
rendered = await app_client.ds.render_template(template)
assert "Hello there, 3,412,341" == rendered
def test_publish_subcommand():
# This is hard to test properly, because publish subcommand plugins
# cannot be loaded using the --plugins-dir mechanism - they need
# to be installed using "pip install". So I'm cheating and taking
# advantage of the fact that cloudrun/heroku use the plugin hook
# to register themselves as default plugins.
assert ["cloudrun", "heroku"] == cli.publish.list_commands({})