diff --git a/IPython/html/services/kernels/tests/test_kernels_api.py b/IPython/html/services/kernels/tests/test_kernels_api.py index 1322878..d04a577 100644 --- a/IPython/html/services/kernels/tests/test_kernels_api.py +++ b/IPython/html/services/kernels/tests/test_kernels_api.py @@ -7,6 +7,7 @@ import json import requests +from IPython.html.utils import url_path_join from IPython.html.tests.launchnotebook import NotebookTestBase @@ -14,7 +15,7 @@ class KernelAPITest(NotebookTestBase): """Test the kernels web service API""" def base_url(self): - return super(KernelAPITest,self).base_url() + 'api/kernels' + return url_path_join(super(KernelAPITest,self).base_url(), 'api/kernels') def mkkernel(self): r = requests.post(self.base_url()) diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py index 17fc9a9..69b6d9e 100644 --- a/IPython/html/services/notebooks/filenbmanager.py +++ b/IPython/html/services/notebooks/filenbmanager.py @@ -117,7 +117,20 @@ class FileNotebookManager(NotebookManager): return os.path.isfile(path) def list_notebooks(self, path): - """List all notebooks in the notebook dir.""" + """Returns a list of dictionaries that are the standard model + for all notebooks in the relative 'path'. + + Parameters + ---------- + path : str + the URL path that describes the relative path for the + listed notebooks + + Returns + ------- + notebooks : list of dicts + a list of the notebook models without 'content' + """ notebook_names = self.get_notebook_names(path) notebooks = [] for name in notebook_names: @@ -127,7 +140,22 @@ class FileNotebookManager(NotebookManager): return notebooks def get_notebook_model(self, name, path='/', content=True): - """read a notebook object from a path""" + """ Takes a path and name for a notebook and returns it's model + + Parameters + ---------- + name : str + the name of the notebook + path : str + the URL path that describes the relative path for + the notebook + + Returns + ------- + model : dict + the notebook model. If contents=True, returns the 'contents' + dict in the model as well. + """ os_path = self.get_os_path(name, path) if not os.path.isfile(os_path): raise web.HTTPError(404, u'Notebook does not exist: %s' % name) diff --git a/IPython/html/services/notebooks/tests/test_notebooks_api.py b/IPython/html/services/notebooks/tests/test_notebooks_api.py index aff2075..50236a4 100644 --- a/IPython/html/services/notebooks/tests/test_notebooks_api.py +++ b/IPython/html/services/notebooks/tests/test_notebooks_api.py @@ -8,13 +8,14 @@ from zmq.utils import jsonapi import requests +from IPython.html.utils import url_path_join from IPython.html.tests.launchnotebook import NotebookTestBase class APITest(NotebookTestBase): """Test the kernels web service API""" def notebook_url(self): - return super(APITest,self).base_url() + 'api/notebooks' + return url_path_join(super(APITest,self).base_url(), 'api/notebooks') def mknb(self, name='', path='/'): url = self.notebook_url() + path diff --git a/IPython/html/services/sessions/tests/test_sessions_api.py b/IPython/html/services/sessions/tests/test_sessions_api.py index eca503a..e195919 100644 --- a/IPython/html/services/sessions/tests/test_sessions_api.py +++ b/IPython/html/services/sessions/tests/test_sessions_api.py @@ -8,14 +8,14 @@ from zmq.utils import jsonapi import requests +from IPython.html.utils import url_path_join from IPython.html.tests.launchnotebook import NotebookTestBase - class SessionAPITest(NotebookTestBase): """Test the sessions web service API""" def notebook_url(self): - return super(SessionAPITest,self).base_url() + 'api/notebooks' + return url_path_join(super(SessionAPITest,self).base_url(), 'api/notebooks') def session_url(self): return super(SessionAPITest,self).base_url() + 'api/sessions'