Ejemplo n.º 1
0
    def test_cached_db(self):
        state = dict(dbs={}, cache_time=0, max_cache_age=10 * 60)

        # no database, cached_db should return None
        assert tasks.cached_db(state) is None

        db_path = self.create_db('test', [("A", "1"), ("A", "2"), ("B", "1")])

        assert tasks.cached_db(state)
        assert db_path in state['dbs']
Ejemplo n.º 2
0
    def test_cached_db(self):
        state = dict(dbs={}, cache_time=0, max_cache_age=10 * 60)

        # no database, cached_db should return None
        assert tasks.cached_db(state) is None

        db_path = self.create_db("test", [("A", "1"), ("A", "2"), ("B", "1")])

        assert tasks.cached_db(state)
        assert db_path in state["dbs"]
Ejemplo n.º 3
0
  def test_cached_db(self):
    state = dict(
      dbs={},
      cache_time = 0,
      max_cache_age = 10 * 60
    )

    # no database, cached_db should return None
    assert tasks.cached_db(state) is None
    

    db_path = self.create_db(
      'test',
      [("A", "1"), ("A", "2"), ("B","1")]
    )

    # scan has already been done, we should have no db
    assert tasks.cached_db(state) is None
    assert db_path not in state['dbs']
    
    state['cache_time'] = 0

    assert tasks.cached_db(state)
    assert db_path in state['dbs']