mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Remove hashed URL mode
Also simplified how view class routing works. Refs #1661
This commit is contained in:
parent
30e5f0e67c
commit
d4f60c2388
12 changed files with 79 additions and 266 deletions
|
|
@ -1,6 +1,5 @@
|
|||
from datasette.app import Datasette
|
||||
from datasette.utils import PrefixedUrlString
|
||||
from .fixtures import app_client_with_hash
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
@ -147,20 +146,3 @@ def test_row(ds, base_url, format, expected):
|
|||
actual = ds.urls.row("_memory", "facetable", "1", format=format)
|
||||
assert actual == expected
|
||||
assert isinstance(actual, PrefixedUrlString)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("base_url", ["/", "/prefix/"])
|
||||
def test_database_hashed(app_client_with_hash, base_url):
|
||||
ds = app_client_with_hash.ds
|
||||
original_base_url = ds._settings["base_url"]
|
||||
try:
|
||||
ds._settings["base_url"] = base_url
|
||||
db_hash = ds.get_database("fixtures").hash
|
||||
assert len(db_hash) == 64
|
||||
expected = f"{base_url}fixtures-{db_hash[:7]}"
|
||||
assert ds.urls.database("fixtures") == expected
|
||||
assert ds.urls.table("fixtures", "name") == expected + "/name"
|
||||
assert ds.urls.query("fixtures", "name") == expected + "/name"
|
||||
finally:
|
||||
# Reset this since fixture is shared with other tests
|
||||
ds._settings["base_url"] = original_base_url
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue