mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-30 13:23:14 +00:00
[virus] Fix url error when records number more than 9
This commit is contained in:
parent
a5056c7a67
commit
ebcd7ed44d
@ -270,7 +270,7 @@ if EVENTS_ENABLED:
|
||||
urlpatterns += patterns(
|
||||
'',
|
||||
url(r'^sys/virus_scan_records/$', sys_virus_scan_records, name='sys_virus_scan_records'),
|
||||
url(r'^sys/virus_scan_records/delete/(?P<vid>[\d+])/$', sys_delete_virus_scan_records, name='sys_delete_virus_scan_records'),
|
||||
url(r'^sys/virus_scan_records/delete/(?P<vid>\d+)/$', sys_delete_virus_scan_records, name='sys_delete_virus_scan_records'),
|
||||
)
|
||||
|
||||
if settings.SERVE_STATIC:
|
||||
|
48
tests/seahub/views/sysadmin/test_sys_virus_scan_records.py
Normal file
48
tests/seahub/views/sysadmin/test_sys_virus_scan_records.py
Normal file
@ -0,0 +1,48 @@
|
||||
from mock import patch
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from seahub.test_utils import BaseTestCase
|
||||
|
||||
|
||||
class VirusScanRecord(object):
|
||||
def __init__(self, repo_id):
|
||||
self.repo_id = repo_id
|
||||
|
||||
|
||||
class SysVirusScanRecordsTest(BaseTestCase):
|
||||
|
||||
# @patch('seahub.utils.EVENTS_ENABLED', True)
|
||||
# @patch('seahub.utils.get_virus_record')
|
||||
# def test_can_list_empty(self, mock_get_virus_record):
|
||||
# mock_get_virus_record.return_value = []
|
||||
|
||||
# self.login_as(self.admin)
|
||||
|
||||
# resp = self.client.get(reverse('sys_virus_scan_records'))
|
||||
# self.assertEqual(200, resp.status_code)
|
||||
# self.assertTemplateUsed(resp, 'sysadmin/sys_virus_scan_records.html')
|
||||
|
||||
def _get_virus_record(self, start, limit):
|
||||
records = []
|
||||
for i in range(11):
|
||||
record = VirusScanRecord(self.repo.id)
|
||||
record.vid = i + 1
|
||||
record.has_handle = False
|
||||
records.append(record)
|
||||
|
||||
return records
|
||||
|
||||
@patch('seahub.utils.EVENTS_ENABLED')
|
||||
@patch('seahub.utils.get_virus_record')
|
||||
def test_can_list_records_num_more_than_10(self, mock_get_virus_record,
|
||||
mock_events_enabled):
|
||||
mock_events_enabled = True
|
||||
mock_get_virus_record.side_effect = self._get_virus_record
|
||||
|
||||
self.login_as(self.admin)
|
||||
|
||||
resp = self.client.get(reverse('sys_virus_scan_records'))
|
||||
self.assertEqual(200, resp.status_code)
|
||||
self.assertTemplateUsed(resp, 'sysadmin/sys_virus_scan_records.html')
|
||||
assert len(resp.context['records']) >= 10
|
Loading…
Reference in New Issue
Block a user