diff --git a/datasette/app.py b/datasette/app.py index 5b99147b..7466c42c 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -455,10 +455,10 @@ class Datasette: "/-/config", ) app.add_route( - DatabaseView.as_view(self), "/" + DatabaseDownload.as_view(self), "/" ) app.add_route( - DatabaseDownload.as_view(self), "/" + DatabaseView.as_view(self), "/" ) app.add_route( TableView.as_view(self), diff --git a/tests/fixtures.py b/tests/fixtures.py index 077d4eb8..004a0b03 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -24,9 +24,9 @@ class TestClient: @pytest.fixture(scope='session') -def app_client(sql_time_limit_ms=None, max_returned_rows=None, config=None): +def app_client(sql_time_limit_ms=None, max_returned_rows=None, config=None, filename="fixtures.db"): with tempfile.TemporaryDirectory() as tmpdir: - filepath = os.path.join(tmpdir, 'fixtures.db') + filepath = os.path.join(tmpdir, filename) conn = sqlite3.connect(filepath) conn.executescript(TABLES) os.chdir(os.path.dirname(filepath)) @@ -78,6 +78,11 @@ def app_client_csv_max_mb_one(): }) +@pytest.fixture(scope="session") +def app_client_with_dot(): + yield from app_client(filename="fixtures.dot.db") + + def generate_compound_rows(num): for a, b, c in itertools.islice( itertools.product(string.ascii_lowercase, repeat=3), num diff --git a/tests/test_api.py b/tests/test_api.py index 53329efd..61987f0a 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -3,6 +3,7 @@ from .fixtures import ( # noqa app_client_shorter_time_limit, app_client_larger_cache_size, app_client_returned_rows_matches_page_size, + app_client_with_dot, generate_compound_rows, generate_sortable_rows, METADATA, @@ -356,6 +357,11 @@ def test_database_page(app_client): }] == data['tables'] +def test_database_page_for_database_with_dot_in_name(app_client_with_dot): + response = app_client_with_dot.get("/fixtures.dot.json") + assert 200 == response.status + + def test_custom_sql(app_client): response = app_client.get( '/fixtures.json?sql=select+content+from+simple_primary_key&_shape=objects'