[tracker] functional-tests: do not assume the DB is pristine



commit a7773ca723dc22ddf3bfb32145f8e9b37f90c68b
Author: Ivan Frade <ivan frade nokia com>
Date:   Thu Sep 23 12:17:58 2010 +0300

    functional-tests: do not assume the DB is pristine
    
    Not really needed for the tests. But we need to check why is it affecting them on devices.

 tests/functional-tests/15-statistics.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/15-statistics.py b/tests/functional-tests/15-statistics.py
index 89eee4c..89efc3d 100755
--- a/tests/functional-tests/15-statistics.py
+++ b/tests/functional-tests/15-statistics.py
@@ -90,7 +90,11 @@ class TrackerStoreStatisticsTests (CommonTrackerStoreTest):
             if k in increased_classes:
                 self.assertEquals (old_stats [k]+1, new_stats[k])
             elif k in new_classes:
-                self.assertEquals (new_stats [k], 1)
+                # This classes could exists previous or not!
+                if old_stats.has_key (k):
+                    self.assertEquals (old_stats [k]+1, new_stats [k])
+                else:
+                    self.assertEquals (new_stats [k], 1)
             else:
                 self.assertEquals (old_stats [k], new_stats[k])
 
@@ -103,11 +107,14 @@ class TrackerStoreStatisticsTests (CommonTrackerStoreTest):
         new_stats = self.__get_stats ()
 
         decreased_classes = [NIE_IE, RDFS_RESOURCE]
-        # These classes shouldn't have any instance, so they are not in the results
+        # These classes could have no instance
         no_instances_classes = ["nmm:Photo", "nfo:Visual", "nfo:Image", "nfo:Media"]
 
         for c in no_instances_classes:
-            self.assertNotIn (c, new_stats)
+            if (old_stats[c] == 1):
+                self.assertNotIn (c, new_stats)
+            else:
+                self.assertEquals (old_stats[c]-1, new_stats[c])
 
         for k, v in new_stats.iteritems ():
             if k in decreased_classes:



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