##// END OF EJS Templates
TEST: Add test for handling of last_modified....
Scott Sanderson -
Show More
@@ -257,6 +257,30 b' class TestContentsManager(TestCase):'
257 257 self.assertEqual(model['name'], 'untitled')
258 258 self.assertEqual(model['path'], '%s/untitled' % sub_dir)
259 259
260 def test_modified_date(self):
261
262 cm = self.contents_manager
263
264 # Create a new notebook.
265 nb, name, path = self.new_notebook()
266 model = cm.get(path)
267
268 # Add a cell and save.
269 self.add_code_cell(model['content'])
270 cm.save(model, path)
271
272 # Reload notebook and verify that last_modified incremented.
273 saved = cm.get(path)
274 self.assertGreater(saved['last_modified'], model['last_modified'])
275
276 # Move the notebook and verify that last_modified stayed the same.
277 # (The frontend fires a warning if last_modified increases on the
278 # renamed file.)
279 new_path = 'renamed.ipynb'
280 cm.rename(path, new_path)
281 renamed = cm.get(new_path)
282 self.assertEqual(renamed['last_modified'], saved['last_modified'])
283
260 284 def test_get(self):
261 285 cm = self.contents_manager
262 286 # Create a notebook
General Comments 0
You need to be logged in to leave comments. Login now