Skip to content

Commit ef06d15

Browse files
committed
Test indexpage option
1 parent b08ff6e commit ef06d15

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/resources/jupyter_server_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
'command': ['python3', './tests/resources/httpinfo.py', '{port}'],
1111
'port': 54321,
1212
},
13+
'python-http-indexpage': {
14+
'command': ['python3', './tests/resources/httpinfo.py', '{port}'],
15+
'indexpage': 'index.html',
16+
},
1317
}
1418

1519
import sys

tests/test_proxies.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ def test_server_proxy_port_absolute():
5858
assert 'X-Forwarded-Context' not in s
5959
assert 'X-Proxycontextpath' not in s
6060

61+
62+
def test_server_proxy_indexpage_index():
63+
r = request_get(PORT, '/python-http-indexpage/', TOKEN)
64+
assert r.code == 200
65+
s = r.read().decode('ascii')
66+
assert s.startswith('GET /index.html?token=')
67+
assert 'X-Forwarded-Context: /python-http-indexpage\n' in s
68+
assert 'X-Proxycontextpath: /python-http-indexpage\n' in s
69+
70+
71+
def test_server_proxy_indexpage_other():
72+
r = request_get(PORT, '/python-http-indexpage/pqr', TOKEN)
73+
assert r.code == 200
74+
s = r.read().decode('ascii')
75+
assert s.startswith('GET /pqr?token=')
76+
assert 'X-Forwarded-Context: /python-http-indexpage\n' in s
77+
assert 'X-Proxycontextpath: /python-http-indexpage\n' in s
78+
79+
6180
def test_server_proxy_remote():
6281
r = request_get(PORT, '/newproxy', TOKEN, host='127.0.0.1')
6382
assert r.code == 200

0 commit comments

Comments
 (0)