mirror of
https://github.com/simonw/dclient.git
synced 2026-09-29 13:24:14 +02:00
Test for datasette plugin registration, refs #4
This commit is contained in:
parent
bf6c709804
commit
2c9af739c2
2 changed files with 33 additions and 1 deletions
23
tests/test_datasette_plugin.py
Normal file
23
tests/test_datasette_plugin.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from click.testing import CliRunner
|
||||
from datasette.app import Datasette
|
||||
from datasette.cli import cli
|
||||
import pytest
|
||||
|
||||
|
||||
def test_plugin_help():
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["client", "--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "Usage: cli client" in result.output
|
||||
bits = result.output.split("Commands:")
|
||||
assert "alias" in bits[1]
|
||||
assert "query" in bits[1]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_plugin_installed():
|
||||
ds = Datasette(memory=True)
|
||||
await ds.invoke_startup()
|
||||
response = await ds.client.get("/-/plugins.json")
|
||||
assert response.status_code == 200
|
||||
assert any(p["name"] == "dclient" for p in response.json())
|
||||
Loading…
Add table
Add a link
Reference in a new issue