diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py
index 2276d637f..fd4d70ebc 100644
--- a/IPython/html/services/notebooks/filenbmanager.py
+++ b/IPython/html/services/notebooks/filenbmanager.py
@@ -153,6 +153,8 @@ class FileNotebookManager(NotebookManager):
nbpath = self.get_os_path(name, path=path)
return os.path.isfile(nbpath)
+ # TODO: Remove this after we create the contents web service and directories are
+ # no longer listed by the notebook web service.
def list_dirs(self, path):
"""List the directories for a given API style path."""
path = path.strip('/')
@@ -167,6 +169,8 @@ class FileNotebookManager(NotebookManager):
dirs = sorted(dirs, key=lambda item: item['name'])
return dirs
+ # TODO: Remove this after we create the contents web service and directories are
+ # no longer listed by the notebook web service.
def get_dir_model(self, name, path=''):
"""Get the directory model given a directory name and its API style path"""
path = path.strip('/')
diff --git a/IPython/html/services/notebooks/tests/test_nbmanager.py b/IPython/html/services/notebooks/tests/test_nbmanager.py
index 8d0adfae1..1a4245109 100644
--- a/IPython/html/services/notebooks/tests/test_nbmanager.py
+++ b/IPython/html/services/notebooks/tests/test_nbmanager.py
@@ -15,6 +15,7 @@ from IPython.html.utils import url_path_join
from ..filenbmanager import FileNotebookManager
from ..nbmanager import NotebookManager
+
class TestFileNotebookManager(TestCase):
def test_nb_dir(self):
diff --git a/IPython/html/services/notebooks/tests/test_notebooks_api.py b/IPython/html/services/notebooks/tests/test_notebooks_api.py
index 4e6e04de2..e9e17fa32 100644
--- a/IPython/html/services/notebooks/tests/test_notebooks_api.py
+++ b/IPython/html/services/notebooks/tests/test_notebooks_api.py
@@ -21,6 +21,12 @@ from IPython.utils import py3compat
from IPython.utils.data import uniq_stable
+# TODO: Remove this after we create the contents web service and directories are
+# no longer listed by the notebook web service.
+def notebooks_only(nb_list):
+ return [nb for nb in nb_list if 'type' not in nb]
+
+
class NBAPI(object):
"""Wrapper for notebook API calls."""
def __init__(self, base_url):
@@ -125,25 +131,25 @@ class APITest(NotebookTestBase):
os.unlink(pjoin(nbdir, 'inroot.ipynb'))
def test_list_notebooks(self):
- nbs = self.nb_api.list().json()
+ nbs = notebooks_only(self.nb_api.list().json())
self.assertEqual(len(nbs), 1)
self.assertEqual(nbs[0]['name'], 'inroot.ipynb')
- nbs = self.nb_api.list('/Directory with spaces in/').json()
+ nbs = notebooks_only(self.nb_api.list('/Directory with spaces in/').json())
self.assertEqual(len(nbs), 1)
self.assertEqual(nbs[0]['name'], 'inspace.ipynb')
- nbs = self.nb_api.list(u'/unicodé/').json()
+ nbs = notebooks_only(self.nb_api.list(u'/unicodé/').json())
self.assertEqual(len(nbs), 1)
self.assertEqual(nbs[0]['name'], 'innonascii.ipynb')
self.assertEqual(nbs[0]['path'], u'unicodé')
- nbs = self.nb_api.list('/foo/bar/').json()
+ nbs = notebooks_only(self.nb_api.list('/foo/bar/').json())
self.assertEqual(len(nbs), 1)
self.assertEqual(nbs[0]['name'], 'baz.ipynb')
self.assertEqual(nbs[0]['path'], 'foo/bar')
- nbs = self.nb_api.list('foo').json()
+ nbs = notebooks_only(self.nb_api.list('foo').json())
self.assertEqual(len(nbs), 4)
nbnames = { normalize('NFC', n['name']) for n in nbs }
expected = [ u'a.ipynb', u'b.ipynb', u'name with spaces.ipynb', u'unicodé.ipynb']
@@ -231,7 +237,7 @@ class APITest(NotebookTestBase):
self.assertEqual(resp.status_code, 204)
for d in self.dirs + ['/']:
- nbs = self.nb_api.list(d).json()
+ nbs = notebooks_only(self.nb_api.list(d).json())
self.assertEqual(len(nbs), 0)
def test_rename(self):
@@ -240,7 +246,7 @@ class APITest(NotebookTestBase):
self.assertEqual(resp.json()['name'], 'z.ipynb')
assert os.path.isfile(pjoin(self.notebook_dir.name, 'foo', 'z.ipynb'))
- nbs = self.nb_api.list('foo').json()
+ nbs = notebooks_only(self.nb_api.list('foo').json())
nbnames = set(n['name'] for n in nbs)
self.assertIn('z.ipynb', nbnames)
self.assertNotIn('a.ipynb', nbnames)