Add test for copying notebook through REST API

This commit is contained in:
Thomas Kluyver 2013-10-08 11:37:51 -07:00 committed by MinRK
parent 7725025d52
commit b9310d0e05

View File

@ -42,6 +42,9 @@ class NBAPI(object):
def upload(self, name, body, path='/'):
return self._req('POST', url_path_join(path, name), body)
def copy(self, name, path='/'):
return self._req('POST', url_path_join(path, name, 'copy'))
def save(self, name, body, path='/'):
return self._req('PUT', url_path_join(path, name), body)
@ -153,6 +156,10 @@ class APITest(NotebookTestBase):
body=jsonapi.dumps(nbmodel))
self._check_nb_created(resp, 'Upload test.ipynb', 'foo')
def test_copy(self):
resp = self.nb_api.copy('a.ipynb', path='foo')
self._check_nb_created(resp, 'a-Copy0.ipynb', 'foo')
def test_delete(self):
for d, name in self.dirs_nbs:
resp = self.nb_api.delete('%s.ipynb' % name, d)