File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
from pathlib import Path
2
2
3
+ import pytest
4
+
3
5
from pydatalab .config import ServerConfig
4
6
from pydatalab .main import create_app
5
7
@@ -36,3 +38,17 @@ def test_config_override():
36
38
37
39
assert CONFIG .REMOTE_FILESYSTEMS [0 ].hostname is None
38
40
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" )
You can’t perform that action at this time.
0 commit comments