Ejemplo n.º 1
0
    def test_set_overwrite(self):
        engine = 'engine'
        tag = 'tag'
        filename = 'temp_file'
        filename2 = 'temp_file2'

        with open_cache(self.db_file, 1000) as cache:
            with temp_file(filename):
                cache.set(engine, tag, filename)
                self.assertEqual(cache.get(engine, tag), filename)

            with temp_file(filename2):
                cache.set(engine, tag, filename2)
                self.assertEqual(cache.get(engine, tag), filename2)
Ejemplo n.º 2
0
    def test_get(self):
        engine = 'engine'
        tag = 'tag'
        filename = 'test_file'

        with open_cache(self.db_file, 1000) as cache:
            self.assertEqual(cache.get(engine, tag), None)

            with temp_file(filename):
                cache.set(engine, tag, filename)

                self.assertEqual(cache.get(engine, tag), filename)