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 |
@@ -460,6 +460,12 b' class TestContentsManager(TestCase):' | |||||
460 | # Check that a 'get' on the deleted notebook raises and error |
|
460 | # Check that a 'get' on the deleted notebook raises and error | |
461 | self.assertRaises(HTTPError, cm.get, path) |
|
461 | self.assertRaises(HTTPError, cm.get, path) | |
462 |
|
462 | |||
|
463 | def test_delete_root(self): | |||
|
464 | cm = self.contents_manager | |||
|
465 | with self.assertRaises(HTTPError) as err: | |||
|
466 | cm.delete('') | |||
|
467 | self.assertEqual(err.exception.status_code, 400) | |||
|
468 | ||||
463 | def test_copy(self): |
|
469 | def test_copy(self): | |
464 | cm = self.contents_manager |
|
470 | cm = self.contents_manager | |
465 | parent = u'å b' |
|
471 | parent = u'å b' |
General Comments 0
You need to be logged in to leave comments.
Login now