@@ -160,15 +160,14 @@ def _configurable_serverapp(
160
160
c = Config (config )
161
161
c .NotebookNotary .db_file = ":memory:"
162
162
token = hexlify (os .urandom (4 )).decode ("ascii" )
163
- url_prefix = "/"
164
163
app = ServerApp .instance (
165
164
# Set the log level to debug for testing purposes
166
165
log_level = 'DEBUG' ,
167
166
port = http_port ,
168
167
port_retries = 0 ,
169
168
open_browser = False ,
170
169
root_dir = str (root_dir ),
171
- base_url = url_prefix ,
170
+ base_url = base_url ,
172
171
config = c ,
173
172
allow_root = True ,
174
173
token = token ,
@@ -262,9 +261,10 @@ async def my_test(jp_fetch):
262
261
"""
263
262
def client_fetch (* parts , headers = {}, params = {}, ** kwargs ):
264
263
# Handle URL strings
265
- path_url = url_escape (url_path_join (jp_base_url , * parts ), plus = False )
264
+ path_url = url_escape (url_path_join (* parts ), plus = False )
265
+ base_path_url = url_path_join (jp_base_url , path_url )
266
266
params_url = urllib .parse .urlencode (params )
267
- url = path_url + "?" + params_url
267
+ url = base_path_url + "?" + params_url
268
268
# Add auth keys to header
269
269
headers .update (jp_auth_header )
270
270
# Make request.
@@ -275,7 +275,7 @@ def client_fetch(*parts, headers={}, params={}, **kwargs):
275
275
276
276
277
277
@pytest .fixture
278
- def jp_ws_fetch (jp_serverapp , jp_auth_header , jp_http_port ):
278
+ def jp_ws_fetch (jp_serverapp , jp_auth_header , jp_http_port , jp_base_url ):
279
279
"""Sends a websocket request to a test server.
280
280
281
281
The fixture is a factory; it can be called like
@@ -303,10 +303,11 @@ async def my_test(jp_fetch, jp_ws_fetch):
303
303
"""
304
304
def client_fetch (* parts , headers = {}, params = {}, ** kwargs ):
305
305
# Handle URL strings
306
- path = url_escape (url_path_join (* parts ), plus = False )
306
+ path_url = url_escape (url_path_join (* parts ), plus = False )
307
+ base_path_url = url_path_join (jp_base_url , path_url )
307
308
urlparts = urllib .parse .urlparse ('ws://localhost:{}' .format (jp_http_port ))
308
309
urlparts = urlparts ._replace (
309
- path = path ,
310
+ path = base_path_url ,
310
311
query = urllib .parse .urlencode (params )
311
312
)
312
313
url = urlparts .geturl ()
0 commit comments