Show More
@@ -1,3 +1,4 b'' | |||
|
1 | # coding: utf-8 | |
|
1 | 2 | """Tests for the notebook manager.""" |
|
2 | 3 | |
|
3 | 4 | import os |
@@ -208,3 +209,22 b' class TestNotebookManager(TestCase):' | |||
|
208 | 209 | |
|
209 | 210 | # Check that a 'get' on the deleted notebook raises and error |
|
210 | 211 | self.assertRaises(HTTPError, nm.get_notebook_model, name, path) |
|
212 | ||
|
213 | def test_copy_notebook(self): | |
|
214 | with TemporaryDirectory() as td: | |
|
215 | # Test in the root directory | |
|
216 | # Create a notebook | |
|
217 | nm = FileNotebookManager(notebook_dir=td) | |
|
218 | path = u'å b' | |
|
219 | name = u'nb √.ipynb' | |
|
220 | os.mkdir(os.path.join(td, path)) | |
|
221 | orig = nm.create_notebook_model({'name' : name}, path=path) | |
|
222 | ||
|
223 | # copy with unspecified name | |
|
224 | copy = nm.copy_notebook(name, path=path) | |
|
225 | self.assertEqual(copy['name'], orig['name'].replace('.ipynb', '-Copy0.ipynb')) | |
|
226 | ||
|
227 | # copy with specified name | |
|
228 | copy2 = nm.copy_notebook(name, u'copy 2.ipynb', path=path) | |
|
229 | self.assertEqual(copy2['name'], u'copy 2.ipynb') | |
|
230 |
General Comments 0
You need to be logged in to leave comments.
Login now