mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
81be31322a
commit
31fb006a9b
5 changed files with 42 additions and 1 deletions
|
|
@ -1,3 +1,6 @@
|
|||
"""
|
||||
Tests for the datasette.database.Database class
|
||||
"""
|
||||
from datasette.database import Results, MultipleValues
|
||||
from datasette.utils import sqlite3
|
||||
from .fixtures import app_client
|
||||
|
|
|
|||
23
tests/test_internals_datasette.py
Normal file
23
tests/test_internals_datasette.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"""
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue