'Test whether the right operations happen when we receive an invalid metainfo object'

@deferred(timeout=10)
def test_on_got_invalid_metainfo(self):

    def get_metainfo(infohash, callback, **_):
        callback('abcd')
    self.session.lm.ltmgr = MockObject()
    self.session.lm.ltmgr.get_metainfo = get_metainfo
    self.session.lm.ltmgr.shutdown = (lambda : None)
    path = ('magnet:?xt=urn:btih:%s&dn=%s' % (hexlify(UBUNTU_1504_INFOHASH), quote_plus('test    torrent')))
    self.should_check_equality = False
    return self.do_request(('torrentinfo?uri=%s' % path), expected_code=500)
