1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

[fixed] error when use search_path feature

This commit is contained in:
zming
2018-03-22 13:31:32 +08:00
parent bed0ed8bc5
commit 3998466c25
2 changed files with 16 additions and 4 deletions

View File

@@ -61,3 +61,17 @@ class SearchTest(BaseTestCase):
self.login_as(self.user)
resp = self.client.get(self.url)
self.assertEqual(400, resp.status_code)
@patch('seahub.api2.views.HAS_FILE_SEARCH', True)
@patch('seahub.api2.views.search_files')
@pytest.mark.skipif(TRAVIS, reason="")
def test_can_search_with_search_path(self, mock_search_files):
mock_search_files.return_value = self.mock_results, \
self.mock_total
self.login_as(self.user)
resp = self.client.get(self.url + '?q=lian&search_repo=%s&search_path=%s' % (self.repo_id, '/'))
json_resp = json.loads(resp.content)
print json_resp
assert json_resp['total'] == self.mock_total
assert json_resp['results'][0]['repo_id'] == self.mock_results[0]['repo_id']