File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -128,3 +128,7 @@ class CommonOptions:
128
128
129
129
url_prefix : str = ""
130
130
"""The URL prefix where IDOM resources will be served from"""
131
+
132
+ def __post_init__ (self ) -> None :
133
+ if self .url_prefix and not self .url_prefix .startswith ("/" ):
134
+ raise ValueError ("Expected 'url_prefix' to start with '/'" )
Original file line number Diff line number Diff line change 1
1
import pytest
2
2
3
3
from idom import html
4
- from idom .backend ._common import traversal_safe_path , vdom_head_elements_to_html
4
+ from idom .backend ._common import (
5
+ CommonOptions ,
6
+ traversal_safe_path ,
7
+ vdom_head_elements_to_html ,
8
+ )
9
+
10
+
11
+ def test_common_options_url_prefix_starts_with_slash ():
12
+ # no prefix specified
13
+ CommonOptions (url_prefix = "" )
14
+
15
+ with pytest .raises (ValueError , match = "start with '/'" ):
16
+ CommonOptions (url_prefix = "not-start-withslash" )
5
17
6
18
7
19
@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments