mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed crash on /:memory: page
This commit is contained in:
parent
9617e92aa8
commit
ec2db345e9
2 changed files with 7 additions and 0 deletions
|
|
@ -149,6 +149,8 @@ class ConnectedDatabase:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self):
|
def size(self):
|
||||||
|
if self.is_memory:
|
||||||
|
return 0
|
||||||
if self.cached_size is not None:
|
if self.cached_size is not None:
|
||||||
return self.cached_size
|
return self.cached_size
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ def test_homepage(app_client):
|
||||||
assert "fixtures" in response.text
|
assert "fixtures" in response.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_memory_database_page(app_client_with_memory):
|
||||||
|
response = app_client_with_memory.get("/:memory:")
|
||||||
|
assert response.status == 200
|
||||||
|
|
||||||
|
|
||||||
def test_database_page_redirects_with_url_hash(app_client_with_hash):
|
def test_database_page_redirects_with_url_hash(app_client_with_hash):
|
||||||
response = app_client_with_hash.get("/fixtures", allow_redirects=False)
|
response = app_client_with_hash.get("/fixtures", allow_redirects=False)
|
||||||
assert response.status == 302
|
assert response.status == 302
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue