Ejemplo n.º 1
0
class DatabaseTestCase(unittest.TestCase):
    def setUp(self):
        self.L = LocationProviderFactory()

    def test_store(self):
        self.L.store("test", "test_location", "seed")
        value = self.L.database["test"]
        self.assertEqual("test_location", value[0])
        self.assertEqual("seed", value[1])
        diff = datetime.now() - value[2]
        self.assertLess(diff.seconds, 1)
        self.L.store("test", "false_location", "seed")
        self.assertEqual("test_location", value[0], "False override")


    def test_sanitize(self):
        time = datetime(2014, 8, 30, 9, 46, 59)
        self.L.database["test2"] = ["test_location", "seed", time]
        self.L.store("test", "test_location", "seed")
        self.assertEqual(len(self.L.database), 2)
        self.L.sanitize()
        self.assertEqual(len(self.L.database), 1)
Ejemplo n.º 2
0
 def setUp(self):
     self.L = LocationProviderFactory()