##// END OF EJS Templates
Merge pull request #8126 from quantopian/test-modified-date...
Min RK -
r20862:cea0c610 merge
parent child Browse files
Show More
@@ -257,6 +257,33 b' class TestContentsManager(TestCase):'
257 self.assertEqual(model['name'], 'untitled')
257 self.assertEqual(model['name'], 'untitled')
258 self.assertEqual(model['path'], '%s/untitled' % sub_dir)
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.assertGreaterEqual(
283 renamed['last_modified'],
284 saved['last_modified'],
285 )
286
260 def test_get(self):
287 def test_get(self):
261 cm = self.contents_manager
288 cm = self.contents_manager
262 # Create a notebook
289 # Create a notebook
General Comments 0
You need to be logged in to leave comments. Login now