mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Failing test for #597
This commit is contained in:
parent
b6ad1fdc70
commit
8790acfbf1
2 changed files with 25 additions and 0 deletions
|
|
@ -178,6 +178,13 @@ def app_client_two_attached_databases():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def app_client_conflicting_database_names():
|
||||||
|
yield from make_app_client(
|
||||||
|
extra_databases={"foo.db": EXTRA_DATABASE_SQL, "foo-bar.db": EXTRA_DATABASE_SQL}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def app_client_two_attached_databases_one_immutable():
|
def app_client_two_attached_databases_one_immutable():
|
||||||
yield from make_app_client(
|
yield from make_app_client(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from .fixtures import ( # noqa
|
||||||
app_client_larger_cache_size,
|
app_client_larger_cache_size,
|
||||||
app_client_returned_rows_matches_page_size,
|
app_client_returned_rows_matches_page_size,
|
||||||
app_client_two_attached_databases_one_immutable,
|
app_client_two_attached_databases_one_immutable,
|
||||||
|
app_client_conflicting_database_names,
|
||||||
app_client_with_cors,
|
app_client_with_cors,
|
||||||
app_client_with_dot,
|
app_client_with_dot,
|
||||||
generate_compound_rows,
|
generate_compound_rows,
|
||||||
|
|
@ -1652,3 +1653,20 @@ def test_cors(app_client_with_cors, path, status_code):
|
||||||
response = app_client_with_cors.get(path)
|
response = app_client_with_cors.get(path)
|
||||||
assert response.status == status_code
|
assert response.status == status_code
|
||||||
assert "*" == response.headers["Access-Control-Allow-Origin"]
|
assert "*" == response.headers["Access-Control-Allow-Origin"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_common_prefix_database_names(app_client_conflicting_database_names):
|
||||||
|
# https://github.com/simonw/datasette/issues/597
|
||||||
|
assert ["fixtures", "foo", "foo-bar"] == [
|
||||||
|
d["name"]
|
||||||
|
for d in json.loads(
|
||||||
|
app_client_conflicting_database_names.get("/-/databases.json").body
|
||||||
|
)
|
||||||
|
]
|
||||||
|
for db_name, path in (("foo", "/foo.json"), ("foo-bar", "/foo-bar.json")):
|
||||||
|
assert (
|
||||||
|
db_name
|
||||||
|
== json.loads(app_client_conflicting_database_names.get(path).body)[
|
||||||
|
"database"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue