##// END OF EJS Templates
add tests to notebooks api...
Zachary Sailer -
Show More
@@ -92,6 +92,11 b' class FileNotebookManager(NotebookManager):'
92 i = i+1
92 i = i+1
93 return name
93 return name
94
94
95 def os_path_exists(self, path):
96 """Check that the given file system path is valid on this machine."""
97 if os.path.exists(path) is False:
98 raise web.HTTPError(404, "No file or directory found.")
99
95 def notebook_exists(self, name, path='/'):
100 def notebook_exists(self, name, path='/'):
96 """Returns a True if the notebook exists. Else, returns False.
101 """Returns a True if the notebook exists. Else, returns False.
97
102
@@ -31,8 +31,8 b' class APITest(NotebookTestBase):'
31 #url, nb = self.mknb()
31 #url, nb = self.mknb()
32 url = self.notebook_url()
32 url = self.notebook_url()
33 nb = requests.post(url+'/')
33 nb = requests.post(url+'/')
34 print nb.text
35 data = nb.json()
34 data = nb.json()
35 status = nb.status_code
36 assert isinstance(data, dict)
36 assert isinstance(data, dict)
37 self.assertIn('name', data)
37 self.assertIn('name', data)
38 self.assertIn('path', data)
38 self.assertIn('path', data)
@@ -119,7 +119,7 b' class SessionHandler(IPythonHandler):'
119 _session_id_regex = r"(?P<session_id>\w+-\w+-\w+-\w+-\w+)"
119 _session_id_regex = r"(?P<session_id>\w+-\w+-\w+-\w+-\w+)"
120
120
121 default_handlers = [
121 default_handlers = [
122 (r"api/sessions/%s" % _session_id_regex, SessionHandler),
122 (r"/api/sessions/%s" % _session_id_regex, SessionHandler),
123 (r"api/sessions", SessionRootHandler)
123 (r"/api/sessions", SessionRootHandler)
124 ]
124 ]
125
125
General Comments 0
You need to be logged in to leave comments. Login now