[tracker-miners/wip/carlosg/miner-fs-fixes] tests: Add functional test for directory updates updating nfo:belongsToContainer
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/miner-fs-fixes] tests: Add functional test for directory updates updating nfo:belongsToContainer
- Date: Tue, 19 May 2020 14:52:30 +0000 (UTC)
commit 8d1de376d88d4e97647372d35213420dfd7272e9
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue May 19 13:11:17 2020 +0200
tests: Add functional test for directory updates updating nfo:belongsToContainer
Ensure that relationships witch child nodes is preserved after the
nie:InformationElement replacement.
tests/functional-tests/fixtures.py | 2 +-
tests/functional-tests/miner-basic.py | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/tests/functional-tests/fixtures.py b/tests/functional-tests/fixtures.py
index b48447e33..a226b4b0b 100644
--- a/tests/functional-tests/fixtures.py
+++ b/tests/functional-tests/fixtures.py
@@ -49,7 +49,7 @@ log = logging.getLogger(__name__)
AUDIO_GRAPH = "http://tracker.api.gnome.org/ontology/v3/tracker#Audio";
DOCUMENTS_GRAPH = "http://tracker.api.gnome.org/ontology/v3/tracker#Documents";
PICTURES_GRAPH = "http://tracker.api.gnome.org/ontology/v3/tracker#Pictures";
-
+FILESYSTEM_GRAPH = "http://tracker.api.gnome.org/ontology/v3/tracker#FileSystem";
def tracker_test_main():
"""Entry point which must be called by all functional test modules."""
diff --git a/tests/functional-tests/miner-basic.py b/tests/functional-tests/miner-basic.py
index 86f326800..d11332188 100755
--- a/tests/functional-tests/miner-basic.py
+++ b/tests/functional-tests/miner-basic.py
@@ -350,6 +350,33 @@ class MinerCrawlTest(fixtures.TrackerMinerTest):
result = self.__get_text_documents()
self.assertEqual(len(result), 3)
+ def test_10_folder_update(self):
+ """
+ Check that updating a folder updates nfo:belongsToContainer on its children
+ """
+
+ directory_uri = self.uri("test-monitored")
+ directory = self.path("test-monitored")
+ document = self.path("test-monitored/unrelated.txt")
+ resource_id = self.tracker.get_content_resource_id(directory_uri)
+ urn = self.__get_file_urn(directory)
+
+ with self.await_document_inserted(document) as resource:
+ # Force an update on the monitored folder, it needs both
+ # a explicit request, and an attribute change (obtained
+ # indirectly by the new file)
+ with open(document, 'w') as f:
+ f.write(DEFAULT_TEXT)
+ self.miner_fs.index_file(directory_uri)
+
+ new_urn = self.__get_file_urn(directory)
+ # After the update, the InformationElement should be brand new
+ assert(urn != new_urn)
+ # Ensure that children remain consistent, old and new ones
+ self.assertEqual(new_urn,
+ self.__get_parent_urn(self.path("test-monitored/file1.txt")))
+ self.assertEqual(self.__get_parent_urn(document),
+ self.__get_parent_urn(self.path("test-monitored/file1.txt")))
if __name__ == "__main__":
fixtures.tracker_test_main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]