1 from datasette_connectors import monkey; monkey.patch_datasette()
2 from datasette_connectors.connectors import ConnectorList
3 from .dummy import DummyConnector
4 ConnectorList.add_connector('dummy', DummyConnector)
6 from datasette.app import Datasette
7 from datasette.utils.testing import TestClient
14 def populate_file(filepath):
15 dummyfile = open(filepath, "w")
16 dummyfile.write("This is a dummy file. We need something to force a SQLite error")
20 @contextlib.contextmanager
22 max_returned_rows=None,
26 with tempfile.TemporaryDirectory() as tmpdir:
27 filepath = os.path.join(tmpdir, 'dummy_tables.db')
28 populate_file(filepath)
31 immutables = [filepath]
37 'default_page_size': 50,
38 'max_returned_rows': max_returned_rows or 1000,
42 immutables=immutables,
45 client = TestClient(ds.app())
50 @pytest.fixture(scope='session')
52 with make_app_client() as client:
56 @pytest.fixture(scope='session')
57 def app_client_with_hash():
58 with make_app_client(config={"hash_urls": True}, is_immutable=True) as client: