Improve index mounting value clean up code to remove the spaces at the starts and at the end of directories. Closes again GitLab issue #520 Thanks to TheOneValen @ for the report.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-10-09 04:48:25 -04:00
parent 838035291d
commit 1e08653b88
4 changed files with 42 additions and 6 deletions

View File

@@ -14,7 +14,9 @@ from document_indexing.tests import DocumentIndexingTestMixin
from ..filesystems import IndexFilesystem
from .literals import (
TEST_NODE_EXPRESSION, TEST_NODE_EXPRESSION_MULTILINE
TEST_NODE_EXPRESSION, TEST_NODE_EXPRESSION_MULTILINE,
TEST_NODE_EXPRESSION_MULTILINE_EXPECTED, TEST_NODE_EXPRESSION_MULTILINE_2,
TEST_NODE_EXPRESSION_MULTILINE_2_EXPECTED
)
@@ -93,7 +95,24 @@ class IndexFilesystemTestCase(DocumentIndexingTestMixin, DocumentTestMixin, Base
self.assertEqual(
list(index_filesystem.readdir('/', ''))[2:],
[TEST_NODE_EXPRESSION_MULTILINE.replace('\r\n', ' ')]
[TEST_NODE_EXPRESSION_MULTILINE_EXPECTED]
)
def test_multiline_indexes_first_and_last(self):
self._create_index()
self.index.node_templates.create(
parent=self.index.template_root,
expression=TEST_NODE_EXPRESSION_MULTILINE_2,
link_documents=True
)
self.upload_document()
index_filesystem = IndexFilesystem(index_slug=self.index.slug)
self.assertEqual(
list(index_filesystem.readdir('/', ''))[2:],
[TEST_NODE_EXPRESSION_MULTILINE_2_EXPECTED]
)
def test_duplicated_indexes(self):