'Testing whether the callback is correctly invoked when we received metainfo after timeout'

@deferred(timeout=20)
def test_got_metainfo_timeout(self):

    test_deferred = Deferred()
    def metainfo_timeout_cb(metainfo):
        self.assertEqual(metainfo, ('a' * 20))
        test_deferred.callback(None)
    fake_handle = MockObject()
    self.ltmgr.initialize()
    self.ltmgr.metainfo_requests[('a' * 20).encode('hex')] = {'handle': fake_handle, 'timeout_callbacks': [metainfo_timeout_cb], 'callbacks': [], 'notify': True}
    self.ltmgr.get_session().remove_torrent = (lambda _dummy1, _dummy2: None)
    self.ltmgr.got_metainfo(('a' * 20).encode('hex'), timeout=True)
    return test_deferred
