[tracker-miners/wip/carlosg/graphs: 18/18] tests: Perform SELECT DISTINCT to find out resource URN



commit 26a904d6c78549fc9de479d438ce6c01b978386b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 29 18:49:22 2020 +0200

    tests: Perform SELECT DISTINCT to find out resource URN
    
    The test checks that the resource URN is single, which is good, but
    doesn't account for the same URN being returned through multiple graphs.
    Use SELECT DISTINCT so the check remains valid if the resource is
    scattered in different graphs.

 tests/functional-tests/miner-basic.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/tests/functional-tests/miner-basic.py b/tests/functional-tests/miner-basic.py
index a48f83ba1..ae3e70de8 100755
--- a/tests/functional-tests/miner-basic.py
+++ b/tests/functional-tests/miner-basic.py
@@ -56,9 +56,10 @@ class MinerCrawlTest(fixtures.TrackerMinerTest):
 
     def __get_parent_urn(self, filepath):
         result = self.tracker.query("""
-          SELECT nfo:belongsToContainer(?u) WHERE {
+          SELECT DISTINCT ?p WHERE {
               ?u a nfo:FileDataObject ;
-                 nie:url \"%s\" .
+                 nie:url \"%s\" ;
+                 nfo:belongsToContainer ?p
           }
           """ % (self.uri(filepath)))
         self.assertEqual(len(result), 1)


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