[tracker-miners/wip/carlosg/cli-test-fix] tests: Fixup CLI test




commit 8888fe0301b5a423fd2cd8923632c9e077fd5037
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Aug 10 16:21:35 2020 +0200

    tests: Fixup CLI test
    
    Some recent change broke
    https://gitlab.gnome.org/GNOME/tracker-miners/-/merge_requests/230
    even though it merged. Make the test actually locate the files.

 tests/functional-tests/cli.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/tests/functional-tests/cli.py b/tests/functional-tests/cli.py
index 72d9a02d9..32fda7033 100644
--- a/tests/functional-tests/cli.py
+++ b/tests/functional-tests/cli.py
@@ -20,9 +20,11 @@ Test `tracker` commandline tool
 """
 
 import pathlib
+import os
 
 import configuration
 import fixtures
+import shutil
 
 class TestCli(fixtures.TrackerCommandLineTestCase):
     def test_search(self):
@@ -33,19 +35,21 @@ class TestCli(fixtures.TrackerCommandLineTestCase):
         # in the meantime we manually wait for it to finish.
 
         file1 = datadir.joinpath('text/Document 1.txt')
-        file2 = datadir.joinpath('text/Document 2.txt')
+        target1 = pathlib.Path(os.path.join(self.indexed_dir, os.path.basename(file1)))
+        with self.await_document_inserted(target1):
+            shutil.copy(file1, self.indexed_dir)
 
-        with self.await_document_inserted(file1):
-            with self.await_document_inserted(file2):
-                output = self.run_cli(
-                    ['tracker3', 'index', '--file', str(datadir)])
+        file2 = datadir.joinpath('text/Document 2.txt')
+        target2 = pathlib.Path(os.path.join(self.indexed_dir, os.path.basename(file2)))
+        with self.await_document_inserted(target2):
+            shutil.copy(file2, self.indexed_dir)
 
         # FIXME: the --all should NOT be needed.
         # See: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/116
         output = self.run_cli(
             ['tracker3', 'search', '--all', 'banana'])
-        self.assertIn(file1.as_uri(), output)
-        self.assertNotIn(file2.as_uri(), output)
+        self.assertIn(target1.as_uri(), output)
+        self.assertNotIn(target2.as_uri(), output)
 
 
 if __name__ == '__main__':


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]