Skip to content

Commit d96631a

Browse files
committed
Add test for config validation
1 parent 7c7b9ef commit d96631a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pydatalab/tests/test_config.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from pathlib import Path
22

3+
import pytest
4+
35
from pydatalab.config import ServerConfig
46
from pydatalab.main import create_app
57

@@ -36,3 +38,17 @@ def test_config_override():
3638

3739
assert CONFIG.REMOTE_FILESYSTEMS[0].hostname is None
3840
assert CONFIG.REMOTE_FILESYSTEMS[0].path == Path("/")
41+
42+
43+
def test_validators():
44+
# check GitHub org IDs are coerced into strings
45+
config = ServerConfig(GITHUB_ALLOW_LIST=[123], IDENTIFIER_PREFIX="test")
46+
assert config.GITHUB_ALLOW_LIST[0] == "123"
47+
48+
# check that prefix must be set
49+
with pytest.warns():
50+
config = ServerConfig(IDENTIFIER_PREFIX=None)
51+
52+
# check bad prefix
53+
with pytest.raises(RuntimeError):
54+
config = ServerConfig(IDENTIFIER_PREFIX="this prefix is way way too long")

0 commit comments

Comments
 (0)