/usr/lib/python2.7/dist-packages/notebook/services/api/tests/test_api.py is in python-notebook 5.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 32 | """Test the basic /api endpoints"""
import requests
from notebook._tz import isoformat
from notebook.utils import url_path_join
from notebook.tests.launchnotebook import NotebookTestBase
class KernelAPITest(NotebookTestBase):
"""Test the kernels web service API"""
def _req(self, verb, path, **kwargs):
r = self.request(verb, url_path_join('api', path))
r.raise_for_status()
return r
def get(self, path, **kwargs):
return self._req('GET', path)
def test_get_spec(self):
r = self.get('spec.yaml')
assert r.text
def test_get_status(self):
r = self.get('status')
data = r.json()
assert data['connections'] == 0
assert data['kernels'] == 0
assert data['last_activity'].endswith('Z')
assert data['started'].endswith('Z')
assert data['started'] == isoformat(self.notebook.web_app.settings['started'])
|