forked from jupyter-server/jupyter_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_handlers.py
31 lines (21 loc) · 896 Bytes
/
test_handlers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pytest
@pytest.fixture
def jp_server_config(jp_template_dir):
return {
"ServerApp": {"jpserver_extensions": {"simple_ext1": True}},
}
async def test_handler_default(jp_fetch):
r = await jp_fetch("simple_ext1/default", method="GET")
assert r.code == 200
assert r.body.decode().index("Hello Simple 1 - I am the default...") > -1
async def test_handler_template(jp_fetch):
path = "/custom/path"
r = await jp_fetch("simple_ext1/template1/{}".format(path), method="GET")
assert r.code == 200
assert r.body.decode().index("Path: {}".format(path)) > -1
async def test_handler_typescript(jp_fetch):
r = await jp_fetch("simple_ext1/typescript", method="GET")
assert r.code == 200
async def test_handler_error(jp_fetch):
r = await jp_fetch("simple_ext1/nope", method="GET")
assert r.body.decode().index("400 : Bad Request") > -1