datasette/tests
Brandon Roberts baf986c871
New get_metadata() plugin hook for dynamic metadata
The following hook is added:

    get_metadata(
      datasette=self, key=key, database=database, table=table,
      fallback=fallback
    )

This gets called when we're building our metdata for the rest
of the system to use. We merge whatever the plugins return
with any local metadata (from metadata.yml/yaml/json) allowing
for a live-editable dynamic Datasette.

As a security precation, local meta is *not* overwritable by
plugin hooks. The workflow for transitioning to live-meta would
be to load the plugin with the full metadata.yaml and save.
Then remove the parts of the metadata that you want to be able
to change from the file.

* Avoid race condition: don't mutate databases list

This avoids the nasty "RuntimeError: OrderedDict mutated during
iteration" error that randomly happens when a plugin adds a
new database to Datasette, using `add_database`. This change
makes the add and remove database functions more expensive, but
it prevents the random explosion race conditions that make for
confusing user experience when importing live databases.

Thanks, @brandonrobertz
2021-06-26 15:24:54 -07:00
..
plugins skip_csrf(datasette, scope) plugin hook, refs #1377 2021-06-23 15:40:09 -07:00
test_templates Fix handling of nested custom page wildcard paths, closes #996 2020-10-07 15:51:11 -07:00
__init__.py Broke up test_app into test_api and test_html 2017-12-15 04:08:24 -08:00
build_small_spatialite_db.py New run_sanity_checks mechanism, for SpatiLite 2019-05-11 15:55:30 -07:00
conftest.py Try to handle intermittent FileNotFoundError in tests 2021-06-05 16:02:03 -07:00
fixtures.py Removed rogue pdb=True, refs #1377 2021-06-23 15:50:48 -07:00
spatialite.db New run_sanity_checks mechanism, for SpatiLite 2019-05-11 15:55:30 -07:00
test_api.py Ensure db.path is a string before trying to insert into internal database (#1370) 2021-06-21 08:57:38 -07:00
test_auth.py Modernize code to Python 3.6+ (#1158) 2020-12-23 09:04:32 -08:00
test_black.py Run black against everything, not just tests and datasette dirs 2020-02-13 15:02:10 -08:00
test_canned_queries.py Re-display user's query with an error message if an error occurs (#1346) 2021-06-01 20:46:20 -07:00
test_cli.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_cli_serve_get.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_cli_serve_server.py Use pytest-xdist to speed up tests (#1290) 2021-04-02 20:42:28 -07:00
test_config_dir.py Support for generated columns 2020-11-30 13:29:57 -08:00
test_crossdb.py --crossdb option for joining across databases (#1232) 2021-02-18 14:09:12 -08:00
test_csv.py ?_trace=1 now depends on trace_debug setting, closes #1359 2021-06-05 13:18:37 -07:00
test_custom_pages.py Make custom pages compatible with base_url setting 2021-06-05 11:59:54 -07:00
test_docs.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_facets.py Test and docs for ?_facet_size=max, refs #1337 2021-05-27 09:04:26 -07:00
test_filters.py Fix for arraycontains bug, closes #1239 2021-02-22 16:22:47 -08:00
test_html.py Default 405 for POST, plus tests 2021-06-23 15:40:09 -07:00
test_internal_db.py Compound primary key for foreign_keys table in _internal 2020-12-22 11:04:29 -08:00
test_internals_database.py New .add_memory_database() method, closes #1247 2021-02-28 20:02:18 -08:00
test_internals_datasette.py Renamed datasette.config() to .setting(), closes #1107 2020-11-24 14:06:32 -08:00
test_internals_datasette_client.py Renamed datasette.config() to .setting(), closes #1107 2020-11-24 14:06:32 -08:00
test_internals_request.py Applied Black 2021-01-11 13:34:38 -08:00
test_internals_response.py response.set_cookie(), closes #795 2020-06-09 15:19:37 -07:00
test_internals_urls.py Renamed /:memory: to /_memory, with redirects - closes #1205 2021-01-28 14:48:56 -08:00
test_messages.py Use f-strings in place of .format() 2020-11-15 15:24:22 -08:00
test_package.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_permissions.py New get_metadata() plugin hook for dynamic metadata 2021-06-26 15:24:54 -07:00
test_plugins.py New get_metadata() plugin hook for dynamic metadata 2021-06-26 15:24:54 -07:00
test_publish_cloudrun.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_publish_heroku.py Use context manager instead of plain open (#1211) 2021-03-11 08:15:49 -08:00
test_utils.py Fixed bug with detect_fts for table with single quote in name, closes #1257 2021-06-01 20:27:04 -07:00