mirror of
https://github.com/simonw/dclient.git
synced 2026-07-28 03:44:32 +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
11
setup.py
11
setup.py
|
|
@ -32,6 +32,15 @@ setup(
|
|||
"console_scripts": ["dclient = dclient.cli:cli"],
|
||||
},
|
||||
install_requires=["click", "httpx", "appdirs"],
|
||||
extras_require={"test": ["pytest", "pytest-httpx", "cogapp", "pytest-mock"]},
|
||||
extras_require={
|
||||
"test": [
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-httpx",
|
||||
"cogapp",
|
||||
"pytest-mock",
|
||||
"datasette",
|
||||
]
|
||||
},
|
||||
python_requires=">=3.7",
|
||||
)
|
||||
|
|
|
|||
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