How to use the castero.downloadqueue.DownloadQueue function in castero

To help you get started, we’ve selected a few castero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xgi / castero / tests / test_downloadqueue.py View on Github external
def test_downloadqueue_init():
    mydownloadqueue = DownloadQueue()
    assert isinstance(mydownloadqueue, DownloadQueue)
github xgi / castero / tests / test_datafile.py View on Github external
def test_datafile_download_bad_url(display):
    display.change_status = mock.MagicMock(name="change_status")
    mydownloadqueue = DownloadQueue()
    url = "https://bad"
    DataFile.download_to_file(
        url,
        "datafile_download_temp",
        "datafile download name",
        mydownloadqueue,
        display=display
    )
    while mydownloadqueue.length > 0:
        pass
    assert display.change_status.call_count > 0
    assert not os.path.exists("datafile_download_temp")
github xgi / castero / tests / test_downloadqueue.py View on Github external
def test_downloadqueue_start():
    mydownloadqueue = DownloadQueue()
    mydownloadqueue._display = mock.MagicMock()
    mydownloadqueue.add(episode1)
    episode1.download = mock.MagicMock(name="download")
    mydownloadqueue.start()
    episode1.download.assert_called_with(mydownloadqueue,
                                         mydownloadqueue._display, )
github xgi / castero / tests / test_downloadqueue.py View on Github external
def test_downloadqueue_update():
    mydownloadqueue = DownloadQueue()
    mydownloadqueue.add(episode1)
    mydownloadqueue.start = mock.MagicMock(name="start")
    mydownloadqueue.update()
    assert mydownloadqueue.start.call_count == 1
github xgi / castero / tests / test_datafile.py View on Github external
def test_datafile_download(display):
    display.change_status = mock.MagicMock(name="change_status")
    mydownloadqueue = DownloadQueue()
    url = "https://travis-ci.org/"
    DataFile.download_to_file(
        url,
        "datafile_download_temp",
        "datafile download name",
        mydownloadqueue,
        display=display
    )
    while mydownloadqueue.length > 0:
        pass
    assert display.change_status.call_count > 0
    assert os.path.exists("datafile_download_temp")
    os.remove("datafile_download_temp")
github xgi / castero / tests / test_episode.py View on Github external
def test_episode_download():
    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(my_dir, "downloaded")
    mydownloadqueue = DownloadQueue()
    myfeed = Feed(file=my_dir + "/feeds/valid_basic.xml")
    myepisode = myfeed.parse_episodes()[1]
    DataFile.download_to_file = mock.MagicMock(name="download_to_file")
    myepisode.download(mydownloadqueue)
    assert DataFile.download_to_file.call_count == 1

    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(DataFile.DATA_DIR,
                                                   "downloaded")
github xgi / castero / tests / test_downloadqueue.py View on Github external
def test_downloadqueue_first():
    mydownloadqueue = DownloadQueue()
    mydownloadqueue.add(episode1)
    assert mydownloadqueue.first == episode1
github xgi / castero / tests / test_episode.py View on Github external
def test_episode_download_with_display_no_enclosure(display):
    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(my_dir, "downloaded")
    mydownloadqueue = DownloadQueue()
    myfeed = Feed(file=my_dir + "/feeds/valid_basic.xml")
    myepisode = myfeed.parse_episodes()[1]
    DataFile.download_to_file = mock.MagicMock(name="download_to_file")
    display.change_status = mock.MagicMock(name="change_status")
    myepisode.download(mydownloadqueue, display=display)
    assert display.change_status.call_count == 1

    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(DataFile.DATA_DIR,
                                                   "downloaded")
github xgi / castero / tests / test_episode.py View on Github external
def test_episode_download_with_display(display):
    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(my_dir, "downloaded")
    mydownloadqueue = DownloadQueue()
    myfeed = Feed(file=my_dir + "/feeds/valid_basic.xml")
    myepisode = myfeed.parse_episodes()[1]
    DataFile.download_to_file = mock.MagicMock(name="download_to_file")
    display.change_status = mock.MagicMock(name="change_status")
    myepisode.download(mydownloadqueue, display=display)
    assert DataFile.download_to_file.call_count == 1

    DataFile.DEFAULT_DOWNLOADED_DIR = os.path.join(DataFile.DATA_DIR,
                                                   "downloaded")