'test updating statistics of a torrent (pick a new one)'

def test_update_statistics(self):

    self.session.open_dbhandler = (lambda _: None)
    infohash_1 = ('a' * 20)
    infohash_2 = ('b' * 20)
    torrents = {infohash_1: {'last_seeding_stats': {'time_seeding': 100, 'value': 5}}, infohash_2: {'last_seeding_stats': {}}}
    new_seeding_stats = {'time_seeding': 110, 'value': 1}
    new_seeding_stats_unexist = {'time_seeding': 10, 'value': 8}
    self.session.lm.ltmgr = MockLtSession()
    boost_man = bm.BoostingManager(self.session, self.bsettings)
    boost_man.torrents = torrents
    boost_man.update_torrent_stats(infohash_1, new_seeding_stats)
    self.assertEqual(boost_man.torrents[infohash_1]['last_seeding_stats']['value'], 1)
    boost_man.update_torrent_stats(infohash_2, new_seeding_stats_unexist)
    self.assertEqual(boost_man.torrents[infohash_2]['last_seeding_stats']['value'], 8)
    boost_man.cancel_all_pending_tasks()
