mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
764738dfcb
commit
61419388c1
8 changed files with 36 additions and 40 deletions
|
|
@ -12,26 +12,26 @@ def routes():
|
|||
@pytest.mark.parametrize(
|
||||
"path,expected_class,expected_matches",
|
||||
(
|
||||
("/", "IndexView", {"as_format": ""}),
|
||||
("/foo", "DatabaseView", {"as_format": None, "db_name": "foo"}),
|
||||
("/foo.csv", "DatabaseView", {"as_format": ".csv", "db_name": "foo"}),
|
||||
("/foo.json", "DatabaseView", {"as_format": ".json", "db_name": "foo"}),
|
||||
("/foo.humbug", "DatabaseView", {"as_format": None, "db_name": "foo.humbug"}),
|
||||
("/foo/humbug", "TableView", {"db_name": "foo", "table": "humbug"}),
|
||||
("/foo/humbug.json", "TableView", {"db_name": "foo", "table": "humbug"}),
|
||||
("/foo/humbug.blah", "TableView", {"db_name": "foo", "table": "humbug"}),
|
||||
("/", "IndexView", {"format": ""}),
|
||||
("/foo", "DatabaseView", {"format": None, "database": "foo"}),
|
||||
("/foo.csv", "DatabaseView", {"format": ".csv", "database": "foo"}),
|
||||
("/foo.json", "DatabaseView", {"format": ".json", "database": "foo"}),
|
||||
("/foo.humbug", "DatabaseView", {"format": None, "database": "foo.humbug"}),
|
||||
("/foo/humbug", "TableView", {"database": "foo", "table": "humbug"}),
|
||||
("/foo/humbug.json", "TableView", {"database": "foo", "table": "humbug"}),
|
||||
("/foo/humbug.blah", "TableView", {"database": "foo", "table": "humbug"}),
|
||||
(
|
||||
"/foo/humbug/1",
|
||||
"RowView",
|
||||
{"as_format": None, "db_name": "foo", "pk_path": "1", "table": "humbug"},
|
||||
{"format": None, "database": "foo", "pks": "1", "table": "humbug"},
|
||||
),
|
||||
(
|
||||
"/foo/humbug/1.json",
|
||||
"RowView",
|
||||
{"as_format": ".json", "db_name": "foo", "pk_path": "1", "table": "humbug"},
|
||||
{"format": ".json", "database": "foo", "pks": "1", "table": "humbug"},
|
||||
),
|
||||
("/-/metadata.json", "JsonDataView", {"as_format": ".json"}),
|
||||
("/-/metadata", "JsonDataView", {"as_format": ""}),
|
||||
("/-/metadata.json", "JsonDataView", {"format": ".json"}),
|
||||
("/-/metadata", "JsonDataView", {"format": ""}),
|
||||
),
|
||||
)
|
||||
def test_routes(routes, path, expected_class, expected_matches):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue