22import os
33from unittest .mock import MagicMock
44
5+ import pytest
56from jupyter_server .auth import Authorizer
67from jupyter_server .serverapp import ServerApp
78from tornado .websocket import WebSocketHandler
89
910
11+ @pytest .mark .asyncio
1012async def test_serverapp (jp_serverapp ):
1113 assert isinstance (jp_serverapp , ServerApp )
1214
1315
16+ @pytest .mark .asyncio
1417async def test_get_api_spec (jp_fetch ):
1518 response = await jp_fetch ("api" , "spec.yaml" , method = "GET" )
1619 assert response .code == 200
1720
1821
22+ @pytest .mark .asyncio
1923async def test_send_request (send_request ):
2024 code = await send_request ("api/spec.yaml" , method = "GET" )
2125 assert code == 200
2226
2327
28+ @pytest .mark .asyncio
2429async def test_connection (jp_fetch , jp_ws_fetch , jp_http_port , jp_auth_header ):
2530 # Create kernel
2631 r = await jp_fetch ("api" , "kernels" , method = "POST" , body = "{}" )
@@ -36,6 +41,7 @@ async def test_connection(jp_fetch, jp_ws_fetch, jp_http_port, jp_auth_header):
3641 ws .close ()
3742
3843
44+ @pytest .mark .asyncio
3945async def test_authorizer (jp_server_authorizer , jp_serverapp , jp_base_url ):
4046 auth : Authorizer = jp_server_authorizer (parent = jp_serverapp )
4147 assert isinstance (auth , Authorizer )
@@ -50,6 +56,7 @@ async def test_authorizer(jp_server_authorizer, jp_serverapp, jp_base_url):
5056 assert auth .match_url_to_resource ("/api/shutdown" ) == "server"
5157
5258
59+ @pytest .mark .asyncio
5360async def test_create_notebook (jp_create_notebook ):
5461 nb = jp_create_notebook ("foo.ipynb" )
5562 assert "nbformat" in nb
0 commit comments