def test_init_proxy_host_not_exists(self): s = Session(proxy_host='loveboat.org:8123') proxy = s.session.proxy() assert proxy.type is lt.proxy_type.http assert proxy.hostname == 'loveboat.org' assert proxy.port == 8123 s.set_alive(False)
def session_with_torrent(request): os.chdir('tests') swt = Session(verbose=request.param) swt.add_torrent('data.torrent', seeding=True) def fin(): fr = 'data.fastresume' swt.set_alive(False) os.remove(fr) if os.path.exists(fr) else None os.chdir('../') request.addfinalizer(fin) return swt
def default_session(request): os.chdir('tests') ds = Session(verbose=request.param) def fin(): ds.set_alive(False) os.chdir('../') request.addfinalizer(fin) return ds
def test_init_max_upload_rate_less_equal_zero(self, max_upload_rate): s = Session(max_upload_rate=max_upload_rate) assert s.max_upload_rate == -1 s.set_alive(False)
def test_init_max_download_rate_greater_zero(self): max_download_rate = 500 s = Session(max_download_rate=max_download_rate) assert s.max_download_rate == 1000 * max_download_rate s.set_alive(False)
def test_init_port_max(self, min, max): with pytest.raises(StorjTorrentError): Session(port_min=min, port_max=max)