Commits

Indra Talip committed 3298817

split the no index dir/empty dir tests apart

Comments (0)

Files changed (1)

rhodecode/tests/test_indexer.py

 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from shutil import rmtree
+import os
+import io
 import logging
 import tempfile
 import unittest
+from os.path import join as jn
 
 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
 
     rmtree(TEST_IDX_DIR)
 
 class TestIndexingDaemon(unittest.TestCase):
-    def test_empty_or_no_index_dir(self):
+    def test_empty_index_dir(self):
         empty_index_dir = tempfile.mkdtemp(prefix='rc_whoosh_')
+
         try:
           idxr = WhooshIndexingDaemon(index_location=empty_index_dir,
                              repo_location=TEST_REPO_DIR)
         finally:
           rmtree(empty_index_dir)
 
+    def test_no_index_dir(self):
+        no_index_parent = tempfile.mkdtemp(prefix='rc_whoosh_')
+        no_index_dir = jn(no_index_parent,'no_dir')
+        try:
+          idxr = WhooshIndexingDaemon(index_location=no_index_dir,
+                             repo_location=TEST_REPO_DIR)
+
+          self.assertEqual(os.path.isdir(no_index_dir), True)
+          self.assertEqual(idxr.initial, True)
+          self.assertEqual(len(idxr.repo_paths), 0)
+
+        finally:
+          rmtree(no_index_parent)
+
 # vim:sw=4 sts=4 ~