mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
datasette.urls.table(..., format="json"), closes #1035
Also improved tests for datasette.urls and added format= to some other methods
This commit is contained in:
parent
b84cfe1b08
commit
11eb1e026f
7 changed files with 92 additions and 40 deletions
|
|
@ -382,15 +382,19 @@ def test_table_columns():
|
|||
)
|
||||
def test_path_with_format(path, format, extra_qs, expected):
|
||||
request = Request.fake(path)
|
||||
actual = utils.path_with_format(request, format, extra_qs)
|
||||
actual = utils.path_with_format(request=request, format=format, extra_qs=extra_qs)
|
||||
assert expected == actual
|
||||
|
||||
|
||||
def test_path_with_format_replace_format():
|
||||
request = Request.fake("/foo/bar.csv")
|
||||
assert utils.path_with_format(request, "blob") == "/foo/bar.csv?_format=blob"
|
||||
assert (
|
||||
utils.path_with_format(request, "blob", replace_format="csv") == "/foo/bar.blob"
|
||||
utils.path_with_format(request=request, format="blob")
|
||||
== "/foo/bar.csv?_format=blob"
|
||||
)
|
||||
assert (
|
||||
utils.path_with_format(request=request, format="blob", replace_format="csv")
|
||||
== "/foo/bar.blob"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue