'Test whether cached results of a torrent are returned when fetching the health of a torrent'

@blocking_call_on_reactor_thread
def test_add_gui_request_cached(self):

    self.torrent_checker._torrent_db.addExternalTorrentNoDef(('a' * 20), 'ubuntu.iso', [['a.test', 1234]], [], 5)
    self.torrent_checker._torrent_db.updateTorrentCheckResult(1, ('a' * 20), 5, 10, time.time(), time.time(), 'good', 0)
    def verify_response(result):
        self.assertTrue(('db' in result))
        self.assertEqual(result['db']['seeders'], 5)
        self.assertEqual(result['db']['leechers'], 10)
    return self.torrent_checker.add_gui_request(('a' * 20)).addCallback(verify_response)
