diff options
author | Sascha Silbe <sascha@silbe.org> | 2009-11-12 12:53:18 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha@silbe.org> | 2009-11-12 12:53:18 (GMT) |
commit | b3d0f1d2f2ed42e48f5a82af8ee596d89ae19e3a (patch) | |
tree | a1af3018c12721db972533b4c67255093f3a7e21 | |
parent | 98b4fd2daf761897f92d87d270a17380b0d99a3c (diff) |
test_massops: factor out _filter_properties()
-rw-r--r-- | tests/test_massops.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_massops.py b/tests/test_massops.py index c3c87a5..f04b35a 100644 --- a/tests/test_massops.py +++ b/tests/test_massops.py @@ -12,6 +12,11 @@ DS_DBUS_SERVICE = "org.laptop.sugar.DataStore" DS_DBUS_INTERFACE = "org.laptop.sugar.DataStore" DS_DBUS_PATH = "/org/laptop/sugar/DataStore" NUM_RUNS = int(os.environ.get('MASSOPS_RUNS', '100')) +IGNORE_PROPERTIES = [ + 'checksum', + 'timestamp', + 'uid', +] @decorator.decorator @@ -57,8 +62,7 @@ class MassOpsTestCase(unittest.TestCase): for entry in self._datastore.find({}, ['uid'], byte_arrays=True)[0]: properties = self._datastore.get_properties(entry['uid'], byte_arrays=True) - del properties['uid'], properties['timestamp'] - properties.pop('checksum', None) + self._filter_properties(properties) self.assertEquals(properties, self._create_properties) def test_get_filename(self): @@ -97,6 +101,10 @@ class MassOpsTestCase(unittest.TestCase): finally: os.remove(filename) + def _filter_properties(self, properties): + for key in IGNORE_PROPERTIES: + properties.pop(key, None) + def suite(): test_suite = unittest.TestLoader().loadTestsFromTestCase(MassOpsTestCase) |