def diff_code(self, revision1, revision2): self.keeper._checkout(revision1) nb1 = current.reads( open( os.path.join( self.keeper.work_dir, self.keeper.project_name, self.keeper.project_config['internal-path'], self.notebook, "notebook" + ".ipynb"), "r").read(), "ipynb") self.keeper._checkout(revision2) nb2 = current.reads( open( os.path.join( self.keeper.work_dir, self.keeper.project_name, self.keeper.project_config['internal-path'], self.notebook, "notebook" + ".ipynb"), "r").read(), "ipynb") result_nb = notebook_diff(nb1, nb2) filename_placeholder = "{}-{}: {} and {}".format( self.keeper.project_name, self.notebook, revision1, revision2) app.add_notebook(result_nb, filename_placeholder) print "This diff have number {}".format(len(app.notebooks) - 1)
def test_notebookjson(): client = app.test_client() app.add_notebook({'metadata': {}}, 'foo.ipynb') result = client.get('/notebooks/test_notebook0') assert result.status_code == 200 def fake_callback(contents, filename): fake_callback.called = True app.shutdown_callback(fake_callback) contents = '' result = client.put('/notebooks/test_notebook0', contents) assert result.data == "", result assert fake_callback.called
def test_notebookjson(): client = app.test_client() app.add_notebook({"metadata": {}}, "foo.ipynb") result = client.get("/notebooks/test_notebook0") assert result.status_code == 200 def fake_callback(contents, filename): fake_callback.called = True app.shutdown_callback(fake_callback) contents = "" result = client.put("/notebooks/test_notebook0", contents) assert result.data == "", result assert fake_callback.called