mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 14:42:10 +00:00
@@ -80,7 +80,7 @@ class ViewFileViaSharedDirTest(TestCase, Fixtures):
|
|||||||
'?p=%s&dl=1' % self.file
|
'?p=%s&dl=1' % self.file
|
||||||
resp = self.client.get(dl_url)
|
resp = self.client.get(dl_url)
|
||||||
self.assertEqual(302, resp.status_code)
|
self.assertEqual(302, resp.status_code)
|
||||||
assert '8082/files/' in resp.get('location')
|
assert '8082/f/' in resp.get('location')
|
||||||
|
|
||||||
def test_can_not_download_viewonly(self):
|
def test_can_not_download_viewonly(self):
|
||||||
assert self.fs.get_permissions()['can_download'] is True
|
assert self.fs.get_permissions()['can_download'] is True
|
||||||
|
@@ -41,7 +41,7 @@ class ViewSharedFileTest(TestCase, Fixtures):
|
|||||||
dl_url = reverse('view_shared_file', args=[self.fs.token]) + '?dl=1'
|
dl_url = reverse('view_shared_file', args=[self.fs.token]) + '?dl=1'
|
||||||
resp = self.client.get(dl_url)
|
resp = self.client.get(dl_url)
|
||||||
self.assertEqual(302, resp.status_code)
|
self.assertEqual(302, resp.status_code)
|
||||||
assert '8082/files/' in resp.get('location')
|
assert '8082/f/' in resp.get('location')
|
||||||
|
|
||||||
def test_can_not_download_viewonly(self):
|
def test_can_not_download_viewonly(self):
|
||||||
assert self.fs.get_permissions()['can_download'] is True
|
assert self.fs.get_permissions()['can_download'] is True
|
||||||
@@ -52,18 +52,6 @@ class ViewSharedFileTest(TestCase, Fixtures):
|
|||||||
resp = self.client.get(dl_url)
|
resp = self.client.get(dl_url)
|
||||||
self.assertEqual(404, resp.status_code)
|
self.assertEqual(404, resp.status_code)
|
||||||
|
|
||||||
def test_dl_link_can_use_more_times(self):
|
|
||||||
dl_url = reverse('view_shared_file', args=[self.fs.token]) + '?dl=1'
|
|
||||||
resp = self.client.get(dl_url)
|
|
||||||
self.assertEqual(302, resp.status_code)
|
|
||||||
|
|
||||||
dl_link = resp.get('location')
|
|
||||||
res = requests.get(dl_link)
|
|
||||||
self.assertEqual(200, res.status_code)
|
|
||||||
|
|
||||||
res = requests.get(dl_link)
|
|
||||||
self.assertEqual(200, res.status_code)
|
|
||||||
|
|
||||||
def test_can_view_raw(self):
|
def test_can_view_raw(self):
|
||||||
dl_url = reverse('view_shared_file', args=[self.fs.token]) + '?raw=1'
|
dl_url = reverse('view_shared_file', args=[self.fs.token]) + '?raw=1'
|
||||||
resp = self.client.get(dl_url)
|
resp = self.client.get(dl_url)
|
||||||
|
Reference in New Issue
Block a user