[tracker-miners/sam/test-removable-devices] git add
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/test-removable-devices] git add
- Date: Wed, 18 Aug 2021 13:53:49 +0000 (UTC)
commit 7d20d7b26aabb71872054f94583ceadc4c3f818e
Author: Sam Thursfield <sam afuera me uk>
Date: Wed Aug 18 15:53:42 2021 +0200
git add
tests/functional-tests/miner-removable-media.py | 67 +++++++++++++++++++++++++
1 file changed, 67 insertions(+)
---
diff --git a/tests/functional-tests/miner-removable-media.py b/tests/functional-tests/miner-removable-media.py
new file mode 100755
index 000000000..60c575aae
--- /dev/null
+++ b/tests/functional-tests/miner-removable-media.py
@@ -0,0 +1,67 @@
+# Copyright (C) 2021, Codethink Ltd
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+# Author: Sam Thursfield <sam afuera me uk>
+
+
+import logging
+import pathlib
+
+import fixtures
+
+log = logging.getLogger(__name__)
+
+
+class MinerRemovableMediaTest(fixtures.TrackerMinerRemovableMediaTest):
+ """Tests for tracker-miner-fs with index-removable-devices feature."""
+
+ def setUp(self):
+ super(MinerRemovableMediaTest, self).setUp()
+
+ self.device_path = pathlib.Path(self.workdir).joinpath('removable-device-1')
+ self.device_path.mkdir()
+
+ def __get_text_documents(self):
+ return self.tracker.query("""
+ SELECT DISTINCT ?url WHERE {
+ ?u a nfo:TextDocument ;
+ nie:isStoredAs/nie:url ?url.
+ }
+ """)
+
+ def test_index(self):
+ """Device should be indexed by Tracker when connected."""
+
+ files = ["file1.txt", "dir1/file2.txt"]
+
+ for f in files:
+ path = self.device_path.joinpath(f)
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text("This file exists.")
+
+ self.add_removable_device(self.device_path)
+
+ for f in files:
+ self.ensure_document_inserted(self.device_path.joinpath(f))
+
+ assert len(self.__get_text_documents()) == 2
+
+
+
+
+if __name__ == "__main__":
+ fixtures.tracker_test_main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]