kopia lustrzana https://github.com/simonw/datasette
Fixed crash on /:memory: page
rodzic
9617e92aa8
commit
ec2db345e9
|
@ -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
|
||||||
|
|
Ładowanie…
Reference in New Issue