Last active
June 9, 2016 11:23
-
-
Save ardhipoetra/3e16f6eeee6030cfcfc782d8242425b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_save_resume(self): | |
def do_test(): | |
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.get_state_dir(), "gen.torrent") | |
tdef.save(torrentfn) | |
impl = LibtorrentDownloadImpl(self.session, tdef) | |
event = threading.Event() | |
def callback_resume(_): | |
event.set() | |
def callback((ignored, ignored2)): | |
impl.save_resume_data() | |
impl.saveresume_called_defer.addCallback(callback_resume) | |
deferred = impl.setup(None, None, None, 0) | |
deferred.addCallback(callback) | |
assert event.wait(20) | |
self.startTest(do_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment