kopia lustrzana https://github.com/simonw/datasette
Test proving $env works for datasette.yml, closes #2255
rodzic
f049103852
commit
52a1dac5d2
|
@ -231,10 +231,18 @@ async def test_plugin_config(ds_client):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_plugin_config_env(ds_client):
|
async def test_plugin_config_env(ds_client, monkeypatch):
|
||||||
os.environ["FOO_ENV"] = "FROM_ENVIRONMENT"
|
monkeypatch.setenv("FOO_ENV", "FROM_ENVIRONMENT")
|
||||||
assert {"foo": "FROM_ENVIRONMENT"} == ds_client.ds.plugin_config("env-plugin")
|
assert ds_client.ds.plugin_config("env-plugin") == {"foo": "FROM_ENVIRONMENT"}
|
||||||
del os.environ["FOO_ENV"]
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_plugin_config_env_from_config(monkeypatch):
|
||||||
|
monkeypatch.setenv("FOO_ENV", "FROM_ENVIRONMENT_2")
|
||||||
|
datasette = Datasette(
|
||||||
|
config={"plugins": {"env-plugin": {"setting": {"$env": "FOO_ENV"}}}}
|
||||||
|
)
|
||||||
|
assert datasette.plugin_config("env-plugin") == {"setting": "FROM_ENVIRONMENT_2"}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
Ładowanie…
Reference in New Issue