'create and save torrent definition used in this test file'

def create_tdef(self):

    tdef = TorrentDef()
    sourcefn = os.path.join(TESTS_DATA_DIR, 'video.avi')
    tdef.add_content(sourcefn)
    tdef.set_tracker('http://localhost/announce')
    tdef.finalize()
    torrentfn = os.path.join(self.session.config.get_state_dir(), 'gen.torrent')
    tdef.save(torrentfn)
    return tdef
