mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
23 lines
517 B
Python
23 lines
517 B
Python
"""
|
|
Tests for the datasette.app.Datasette class
|
|
"""
|
|
from .fixtures import app_client
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def datasette(app_client):
|
|
return app_client.ds
|
|
|
|
|
|
def test_get_database(datasette):
|
|
db = datasette.get_database("fixtures")
|
|
assert "fixtures" == db.name
|
|
with pytest.raises(KeyError):
|
|
datasette.get_database("missing")
|
|
|
|
|
|
def test_get_database_no_argument(datasette):
|
|
# Returns the first available database:
|
|
db = datasette.get_database()
|
|
assert "fixtures" == db.name
|