mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
Add test for copying notebook through REST API
This commit is contained in:
parent
7725025d52
commit
b9310d0e05
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user