Beispiel #1
0
def test_download_file_exception(context, fake_session_500, tmpdir,
                                 event_loop):
    path = os.path.join(tmpdir, "foo")
    with pytest.raises(DownloadError):
        event_loop.run_until_complete(
            utils.download_file(context, "url", path,
                                session=fake_session_500))
Beispiel #2
0
def test_download_file(context, fake_session, tmpdir, event_loop):
    path = os.path.join(tmpdir, "foo")
    event_loop.run_until_complete(
        utils.download_file(context, "url", path, session=fake_session))
    with open(path, "r") as fh:
        contents = fh.read()
    assert contents == "asdfasdf"