This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop showing symlinks in search results, closes #458
- Loading branch information
Showing
10 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should be indexed happily. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.mkd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[DXR] | ||
enabled_plugins = pygmentize clang python | ||
es_index = dxr_test_{format}_{tree}_{unique} | ||
es_alias = dxr_test_{format}_{tree} | ||
es_catalog_index = dxr_test_catalog | ||
|
||
[code] | ||
source_folder = code | ||
build_command = | ||
clean_command = | ||
|
||
[[python]] | ||
python_path = ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from nose.tools import eq_, ok_ | ||
|
||
from dxr.testing import DxrInstanceTestCase | ||
|
||
|
||
class SymlinkTests(DxrInstanceTestCase): | ||
def test_follows_link(self): | ||
"""Test that a symlink listed in a browsing view will actually point to the real target. | ||
""" | ||
response = self.client().get('/code/source/') | ||
# Make sure the browse view actually shows the symlink... | ||
ok_('link.mkd' in response.data) | ||
# ...but links to the real file instead. | ||
ok_('<a href="/code/source/link.mkd"' not in response.data) | ||
|
||
def test_file_search(self): | ||
"""Make sure that searching for path:<symlink name> does not return the symlink. | ||
""" | ||
self.found_files_eq('path:mkd', ['README.mkd']) | ||
|
||
def test_line_search(self): | ||
"""Make sure that searching for contents within the real file does not return duplicates | ||
in the symlink. | ||
""" | ||
self.found_files_eq('happily', ['README.mkd']) | ||
|
||
def test_redirect(self): | ||
"""Make sure that a direct link to a symlink redirects to the real file. | ||
""" | ||
response = self.client().get('/code/source/link.mkd') | ||
eq_(response.status_code, 302) | ||
ok_(response.headers['Location'].endswith('/code/source/README.mkd')) |