[tracker] Updated fts functional tests and XML description of the suite



commit 33566d281148d73fc6487ec62cb952ceddb7393b
Author: Ivan Frade <ivan frade nokia com>
Date:   Thu Nov 5 22:02:15 2009 +0200

    Updated fts functional tests and XML description of the suite

 tests/functional-tests/03-fts-functions.py |   46 ++++++++++++++++++++++++++-
 tests/functional-tests/tests.xml           |   12 +++++++
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/tests/functional-tests/03-fts-functions.py b/tests/functional-tests/03-fts-functions.py
index 632212d..8bd5438 100644
--- a/tests/functional-tests/03-fts-functions.py
+++ b/tests/functional-tests/03-fts-functions.py
@@ -82,8 +82,50 @@ class TestFTSFunctions (unittest.TestCase):
         }
         """
 
-    def test_fts_weight (self):
-        pass
+    def test_fts_offsets (self):
+        """
+        1. Insert a Contact1 with 'abcdefxyz' as fullname and nickname
+        2. Insert a Contact2 with 'abcdefxyz' as fullname
+        2. Insert a Contact3 with 'abcdefxyz' as fullname and twice in nickname
+        3. Query fts:offsets for 'abcdefxyz'
+           EXPECTED: The 3 contacts in insertion order, with 2, 1 and 3 pairs (prop, offset=1) each
+        4. Remove the created resources
+        """
+        insert_sparql = """
+        INSERT {
+        <contact://test/fts-function/rank/1> a nco:PersonContact ;
+                       nco:fullname 'abcdefxyz' ;
+                       nco:nickname 'abcdefxyz' .
+
+        <contact://test/fts-function/rank/2> a nco:PersonContact ;
+                       nco:fullname 'abcdefxyz' .
+
+        <contact://test/fts-function/rank/3> a nco:PersonContact ;
+                       nco:fullname 'abcdefxyz' ;
+                       nco:nickname 'abcdefxyz abcdefxyz' .
+        }
+        """
+        self.resources.SparqlUpdate (insert_sparql)
+
+        query = """
+        SELECT fts:offsets (?contact) WHERE {
+           ?contact a nco:PersonContact ;
+                fts:match 'abcdefxyz' .
+        } 
+        """
+        results = self.resources.SparqlQuery (query)
+        self.assertEquals (len(results), 3)
+        self.assertEquals (len (results[0][0].split(",")), 4) # (u'151,1,161,1')
+        self.assertEquals (len (results[1][0].split(",")), 2) # (u'161,1')
+        self.assertEquals (len (results[2][0].split(",")), 6) # (u'151,1,151,2,161,1')
+
+        delete_sparql = """
+        DELETE {
+        <contact://test/fts-function/rank/1> a rdf:Resource .
+        <contact://test/fts-function/rank/2> a rdf:Resource .
+        <contact://test/fts-function/rank/3> a rdf:Resource .
+        }
+        """
         
         
 
diff --git a/tests/functional-tests/tests.xml b/tests/functional-tests/tests.xml
index 4f7318d..54976bf 100644
--- a/tests/functional-tests/tests.xml
+++ b/tests/functional-tests/tests.xml
@@ -14,6 +14,18 @@
         <!-- dbus env variables defined here. This works. -->
         <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/01-insertion.py</step>
       </case>
+
+      <case name="test_metacontact" type="unit" 
+            description="Metacontacts in the ontology" requirement="01" timeout="5" subfeature="">
+        <!-- dbus env variables defined here. This works. -->
+        <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/02-metacontacts.py</step>
+      </case>
+
+      <case name="test_fts" type="unit" 
+            description="Exposed FTS functions in sparql" requirement="01" timeout="5" subfeature="">
+        <!-- dbus env variables defined here. This works. -->
+        <step expected_result="0">. /tmp/session_bus_address.user; python2.5 /usr/share/tracker-tests/03-fts-functions.py</step>
+      </case>
  
       <!-- Environments optional - tells where the tests are run -->
       <environments>



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