mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
add test of copy file in sub dir to dst dir
This commit is contained in:
@@ -5,7 +5,7 @@ Test file/dir operations.
|
||||
|
||||
import random
|
||||
import re
|
||||
from urllib import urlencode, quote
|
||||
from urllib import urlencode, quote, quote
|
||||
|
||||
from tests.common.utils import randstring, urljoin
|
||||
from tests.api.urls import DEFAULT_REPO_URL, REPOS_URL
|
||||
@@ -54,6 +54,22 @@ class FilesApiTest(ApiTestBase):
|
||||
res = self.post(fopurl, data=data)
|
||||
self.assertEqual(res.text, '"success"')
|
||||
|
||||
# create tmp file in sub folder(dpath)
|
||||
tmp_file = 'tmp_file.txt'
|
||||
furl = repo.get_filepath_url(dpath + '/' + tmp_file)
|
||||
data = {'operation': 'create'}
|
||||
res = self.post(furl, data=data, expected=201)
|
||||
|
||||
# copy tmp file(in dpath) to dst dir
|
||||
fopurl = urljoin(repo.repo_url, 'fileops/copy/') + '?p=' + quote(dpath)
|
||||
data = {
|
||||
'file_names': tmp_file,
|
||||
'dst_repo': repo.repo_id,
|
||||
'dst_dir': dpath,
|
||||
}
|
||||
res = self.post(fopurl, data=data)
|
||||
self.assertEqual(res.text, '"success"')
|
||||
|
||||
def test_download_file(self):
|
||||
with self.get_tmp_repo() as repo:
|
||||
fname, furl = self.create_file(repo)
|
||||
|
Reference in New Issue
Block a user