Пример #1
0
def test_dl_dry_cancel():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl')
    assert len(bdl.list_mp3()) > 0
    cb = Callback()
    cb.cancel()
    bdl.download_mp3(dry_run=True, cb=cb)
Пример #2
0
def test_set_overwrite():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl', False)
    assert not bdl.overwrite()
    bdl.overwrite(True)
    assert bdl.overwrite()
    bdl.overwrite(False)
    assert not bdl.overwrite()
Пример #3
0
def test_constructor():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl', False)
    assert bdl._url == 'https://feeds.radiokawa.com/podcast_nawak.xml'
    assert bdl.folder() == './dl'
    assert not bdl.overwrite()
Пример #4
0
def test_dl_dry_no_cb():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl')
    assert len(bdl.list_mp3()) > 0
    bdl.download_mp3(dry_run=True)
Пример #5
0
def test_dl_no_folder():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml')
    assert len(bdl.list_mp3()) > 0
    with pytest.raises(bd.BulkDownloaderException):
        bdl.download_mp3()
Пример #6
0
def test_wrong_server():
    bdl = bd.BulkDownloader('https://feeds.radionawak.com/podcast_nawak2.xml',
                            './dl')
    with pytest.raises(bd.BulkDownloaderException):
        bdl.list_mp3()
Пример #7
0
def test_list_mp3():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl')
    cb = Callback()
    assert len(bdl.list_mp3(cb, True)) > 0
Пример #8
0
def test_set_folder():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl')
    bdl.folder('./dl2')
    assert bdl.folder() == './dl2'
Пример #9
0
def test_dl_dry_files_exist(tmp_directory):
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            tmp_directory, False)
    open(os.path.join(tmp_directory, "NAWAK1.mp3"), "w")
    bdl.download_mp3(None, True)
Пример #10
0
def test_set_last_n():
    bdl = bd.BulkDownloader('https://feeds.radiokawa.com/podcast_nawak.xml',
                            './dl', 2)
    assert bdl.last_n() == 2
    bdl.last_n(10)
    assert bdl.last_n() == 10