Commit graph

1,081 commits

Author SHA1 Message Date
Simon Willison
5bbe2bcc50 Rename filtered_table_rows_count to count, refs #782 2022-12-31 12:52:57 -08:00
Simon Willison
a2dca62360 Fix for extension tests I broke, refs #782 2022-12-31 11:21:15 -08:00
Simon Willison
8aa9cf629c Store null instead of 'None' in _internal database table, closes #1970 2022-12-31 10:52:37 -08:00
Simon Willison
234230e595 Default JSON shape is now objects - refs #1914, #1709 2022-12-31 10:52:37 -08:00
Jan Lehnardt
e03aed0002 Detect server start/stop more reliably.
This is useful, especially in testing, since your test
hosts might not reliabliy start the server within two
seconds, so we do a definite check before progressing.

By the same token, after `kill $server_pid` wait for
the pid to be gone from the process list.

Since now the script can end prematurely, I also added
a cleanup function to make sure the temporary certs are
removed in any case.

n.b. this could also be done with the use of `trap 'fn'
ERR` but that felt like a bit too much magic for this
short a script.
2022-12-18 08:01:51 -08:00
Simon Willison
d1d369456a Move HTTPS test to a bash script
See https://github.com/simonw/datasette/issues/1955#issuecomment-1356627931
2022-12-17 18:33:07 -08:00
Simon Willison
8b73fc6b47 Put AsgiLifestyle back so server starts up again, refs #1955 2022-12-17 17:22:00 -08:00
Simon Willison
89cffcf14c Reset _metadata_local in a couple of tests
Refs https://github.com/simonw/datasette/pull/1960#issuecomment-1356476886
2022-12-17 13:47:55 -08:00
Simon Willison
9c43b4164d Removed @pytest.mark.ds_client mark - refs #1959
I don't need it - can run 'pytest -k ds_client' instead.

See https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828
2022-12-17 13:47:55 -08:00
Simon Willison
0e42444866 invoke_startup() inside ds_client fixture, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
e70974a4f1 Ran Black, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
42a66c2f04 A bunch of remaining ds_client conversions, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
be95359a80 ds_client for test_permissions.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
ef74d0ff70 ds_client for test_internal_db.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
4a151b15cc ds_client for test_filters.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
30f1a0705b ds_client for test_plugins.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
b998c2793f test_facets.py using ds_client, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
bc88491cb7 ds_client for test_table_api.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
1335bcb893 Use my own global variable instead of scope=session
Refs https://github.com/simonw/datasette/pull/1960#issuecomment-1354148139
2022-12-17 13:47:55 -08:00
Simon Willison
ebd3358e49 ds_client for test_table_html.py 2022-12-17 13:47:55 -08:00
Simon Willison
d94d363ec0 Don't use pytest_asyncio.fixture(scope="session") any more, refs #1959
Also got rid of the weird memory=False hack:

https://github.com/simonw/datasette/pull/1960#issuecomment-1354053151
2022-12-17 13:47:55 -08:00
Simon Willison
95900b9d02 Port app_client to ds_client for most of test_html.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
3001eec66a ds_client for test_csv.py and test_canned_queries.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
425ac4357f Ported app_client to ds_client where possible in test_auth.py, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
b077e63dc6 Ported test_api.py app_client test to ds_client, refs #1959 2022-12-17 13:47:55 -08:00
Simon Willison
0b68996cc5 Revert "Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955"
This reverts commit dc18f62089.
2022-12-15 13:06:45 -08:00
Simon Willison
dc18f62089 Replace AsgiLifespan with AsgiRunOnFirstRequest, refs #1955 2022-12-15 09:34:07 -08:00
Simon Willison
c094dde3ff Extra permission rules for /-/create, closes #1937 2022-12-14 12:21:18 -08:00
Simon Willison
e238df3959 Handle non-initials in permission_allowed_actor_restrictions, closes #1956 2022-12-14 12:04:23 -08:00
Simon Willison
1a3dcf4943 Don't include _memory on /-/create-token, refs #1947 2022-12-13 21:19:31 -08:00
Simon Willison
420d0a0ee2 Tests for /-/create-token with restrictions, closes #1947 2022-12-13 21:13:20 -08:00
Simon Willison
d98a8effb1 UI for restricting permissions on /-/create-token, refs #1947
Also fixes test failures I introduced in #1951
2022-12-13 21:03:17 -08:00
Simon Willison
f84acae98e Return 400 errors for ?_sort errors, closes #1950 2022-12-13 14:23:17 -08:00
Simon Willison
45979eb723 Rename permission created by demo plugin
It was showing up as 'new-permission' on https://latest.datasette.io/-/permissions
which I thought was confusing
2022-12-12 21:21:01 -08:00
Simon Willison
a1a372f179 /-/actor no longer requires view-instance, refs #1945 2022-12-12 21:06:30 -08:00
Simon Willison
260fbb598e Fix some failing tests, refs #1855 2022-12-12 21:00:40 -08:00
Simon Willison
809fad2392 Tests for datasette create-token restrictions, refs #1855 2022-12-12 20:44:19 -08:00
Simon Willison
c13dada2f8 datasette --get --token option, closes #1946, refs #1855 2022-12-12 20:36:42 -08:00
Simon Willison
c6a811237c /-/actor.json no longer requires view-instance, closes #1945 2022-12-12 20:11:51 -08:00
Simon Willison
3e6a208ba3 Rename 't' to 'r' in '_r' actor format, refs #1855 2022-12-12 19:27:34 -08:00
Simon Willison
c5d30b58a1 Implemented metadata permissions: property, closes #1636 2022-12-12 18:40:45 -08:00
Simon Willison
8bf06a76b5
register_permissions() plugin hook (#1940)
* Docs for permissions: in metadata, refs #1636
* Refactor default_permissions.py to help with implementation of #1636
* register_permissions() plugin hook, closes #1939 - also refs #1938
* Tests for register_permissions() hook, refs #1939
* Documentation for datasette.permissions, refs #1939
* permission_allowed() falls back on Permission.default, refs #1939
* Raise StartupError on duplicate permissions
* Allow dupe permisisons if exact matches
2022-12-12 18:05:54 -08:00
Simon Willison
34cffff02a Refactor _headers() for write API tests 2022-12-07 17:39:07 -08:00
Simon Willison
dee18ed8ce test_create_table_error_rows_twice_with_duplicates, refs #1927 2022-12-07 17:29:24 -08:00
Simon Willison
9342b60f14 test_create_table_error_if_pk_changed, refs #1927 2022-12-07 17:27:01 -08:00
Simon Willison
6b27537988 ignore/replace to create requires pk, refs #1927 2022-12-07 17:18:40 -08:00
Simon Willison
272982e8a6
/db/table/-/upsert API
Close #1878

Also made a few tweaks to how _r works in tokens and actors,
refs #1855 - I needed that mechanism for the tests.
2022-12-07 17:12:15 -08:00
Simon Willison
93ababe6f7 Initial attempt at insert/replace for /-/create, refs #1927 2022-12-02 23:00:18 -08:00
Simon Willison
d7e5e3c9f9 Fix for todomvc permission check
Refs https://github.com/simonw/todomvc-datasette/issues/2
2022-12-01 17:38:23 -08:00
Simon Willison
27efa8c381 todomvc permissions and fixed DATASETTE_SECRET for new demo
Refs https://github.com/simonw/todomvc-datasette/issues/2
2022-12-01 17:29:44 -08:00