Show More
@@ -222,6 +222,9 b' class ContentsManager(LoggingConfigurable):' | |||||
222 |
|
222 | |||
223 | def delete(self, path): |
|
223 | def delete(self, path): | |
224 | """Delete a file/directory and any associated checkpoints.""" |
|
224 | """Delete a file/directory and any associated checkpoints.""" | |
|
225 | path = path.strip('/') | |||
|
226 | if not path: | |||
|
227 | raise HTTPError(400, "Can't delete root") | |||
225 | self.delete_file(path) |
|
228 | self.delete_file(path) | |
226 | self.checkpoints.delete_all_checkpoints(path) |
|
229 | self.checkpoints.delete_all_checkpoints(path) | |
227 |
|
230 |
@@ -433,6 +433,12 b' class TestContentsManager(TestCase):' | |||||
433 | # Check that a 'get' on the deleted notebook raises and error |
|
433 | # Check that a 'get' on the deleted notebook raises and error | |
434 | self.assertRaises(HTTPError, cm.get, path) |
|
434 | self.assertRaises(HTTPError, cm.get, path) | |
435 |
|
435 | |||
|
436 | def test_delete_root(self): | |||
|
437 | cm = self.contents_manager | |||
|
438 | with self.assertRaises(HTTPError) as err: | |||
|
439 | cm.delete('') | |||
|
440 | self.assertEqual(err.exception.status_code, 400) | |||
|
441 | ||||
436 | def test_copy(self): |
|
442 | def test_copy(self): | |
437 | cm = self.contents_manager |
|
443 | cm = self.contents_manager | |
438 | parent = u'å b' |
|
444 | parent = u'å b' |
General Comments 0
You need to be logged in to leave comments.
Login now