Esempio n. 1
0
def test_get_pdf__with_connect_timeout():
    with requests_mock.Mocker() as m:
        with pytest.raises(requests.exceptions.ConnectTimeout):
            m.get(requests_mock.ANY, exc=requests.exceptions.ConnectTimeout)
            html = cafenero.download_website()
            link = cafenero.extract_dropbox_link(html)
            cafenero.get_pdf(link)
Esempio n. 2
0
def test_download_website__with_connect_timeout():
    with requests_mock.Mocker() as m:
        with pytest.raises(requests.exceptions.ConnectTimeout):
            m.get(requests_mock.ANY, exc=requests.exceptions.ConnectTimeout)
            cafenero.download_website()
Esempio n. 3
0
def test_download_website__with_live_site():
    html = cafenero.download_website()
    assert '<iframe src="https://www.dropbox.com' in html
Esempio n. 4
0
def pdf_file():
    html = cafenero.download_website()
    link = cafenero.extract_dropbox_link(html)
    tmpdir_of_pdf = cafenero.get_pdf(link)
    return tmpdir_of_pdf
Esempio n. 5
0
def test_extract_dropbox_link():
    html = cafenero.download_website()
    link = cafenero.extract_dropbox_link(html)
    assert 'dropbox' in link
    assert 'speisekarte.pdf' in link
Esempio n. 6
0
def test_download_website__with_live_site():
    html = cafenero.download_website()
    assert 'Speisekarte als' in html