'Testing whether adding a torrent with a magnet link to a channel without description works'

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

    my_channel_id = self.create_fake_channel('channel', '')
    def fake_get_metainfo(_, callback, timeout=10, timeout_callback=None, notify=True):
        meta_info = TorrentDef.load(TORRENT_UBUNTU_FILE).get_metainfo()
        callback(meta_info)
    self.session.lm.ltmgr.get_metainfo = fake_get_metainfo
    def verify_method_invocation(channel_id, torrent_def, extra_info=None, forward=True):
        self.assertEqual(my_channel_id, channel_id)
        self.assertEqual(TorrentDef.load(TORRENT_UBUNTU_FILE), torrent_def)
        self.assertEqual({}, (extra_info or {}))
        self.assertEqual(True, forward)
    self.session.add_torrent_def_to_channel = verify_method_invocation
    magnet_url = 'magnet:?fake'
    url = ('channels/discovered/%s/torrents/%s' % ('fakedispersyid'.encode('hex'), urllib.quote_plus(magnet_url)))
    return self.do_request(url, expected_code=200, expected_json={'added': magnet_url}, request_type='PUT')
