mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Keep track of datasette.config_dir (#1766)
Thanks, @eyeseast - closes #1764
This commit is contained in:
parent
22354c48ce
commit
01369176b0
2 changed files with 10 additions and 0 deletions
|
|
@ -211,6 +211,7 @@ class Datasette:
|
||||||
assert config_dir is None or isinstance(
|
assert config_dir is None or isinstance(
|
||||||
config_dir, Path
|
config_dir, Path
|
||||||
), "config_dir= should be a pathlib.Path"
|
), "config_dir= should be a pathlib.Path"
|
||||||
|
self.config_dir = config_dir
|
||||||
self.pdb = pdb
|
self.pdb = pdb
|
||||||
self._secret = secret or secrets.token_hex(32)
|
self._secret = secret or secrets.token_hex(32)
|
||||||
self.files = tuple(files or []) + tuple(immutables or [])
|
self.files = tuple(files or []) + tuple(immutables or [])
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
import pathlib
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datasette.app import Datasette
|
from datasette.app import Datasette
|
||||||
|
|
@ -150,3 +151,11 @@ def test_metadata_yaml(tmp_path_factory, filename):
|
||||||
response = client.get("/-/metadata.json")
|
response = client.get("/-/metadata.json")
|
||||||
assert 200 == response.status
|
assert 200 == response.status
|
||||||
assert {"title": "Title from metadata"} == response.json
|
assert {"title": "Title from metadata"} == response.json
|
||||||
|
|
||||||
|
|
||||||
|
def test_store_config_dir(config_dir_client):
|
||||||
|
ds = config_dir_client.ds
|
||||||
|
|
||||||
|
assert hasattr(ds, "config_dir")
|
||||||
|
assert ds.config_dir is not None
|
||||||
|
assert isinstance(ds.config_dir, pathlib.Path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue