'testing call resume data alert'

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

    tdef = self.create_tdef()
    impl = LibtorrentDownloadImpl(self.session, tdef)
    def resume_ready(_):
        '\n                                                check    if    resume    data    is    ready\n                                                '
        basename = (binascii.hexlify(tdef.get_infohash()) + '.state')
        filename = os.path.join(self.session.get_downloads_pstate_dir(), basename)
        engine_data = CallbackConfigParser()
        engine_data.read_file(filename)
        self.assertEqual(tdef.get_infohash(), engine_data.get('state', 'engineresumedata').get('info-hash'))
    def callback(_):
        '\n                                                callback    after    finishing    setup    in    LibtorrentDownloadImpl\n                                                '
        defer_alert = impl.save_resume_data()
        defer_alert.addCallback(resume_ready)
        return defer_alert
    result_deferred = impl.setup(None, None, 0)
    result_deferred.addCallback(callback)
    return result_deferred.addCallback((lambda _: impl.stop()))
