def test_ok_to_update_date(self): """ Should pass because more than a day has passed """ ctr = Counter.query.first() ctr.timestamp -= timedelta(days=1, seconds=1) db.session.add(ctr) db.session.commit() assert utils.ok_to_update()
def test_ok_to_update_counter(self): """ Should pass because we have more than two new addresses """ ctr = Counter.query.first() ctr.count += 2 db.session.add(ctr) db.session.commit() assert utils.ok_to_update()
def test_ok_to_update_fails(self): """ Should fail because the counter's zero, and < 24 hours old """ assert not utils.ok_to_update()