Esempio n. 1
0
def test_custom_prefix_fragment_ftp():
    saver = FileSaver(base, url_parse('http://freezeyt.test:1234/foo/'))
    with pytest.raises(ValueError):
        saver.url_to_filename(
            url_parse("ftp://localhost:8000/second_page.html"))
Esempio n. 2
0
def test_custom_prefix_above():
    saver = FileSaver(base, url_parse('http://freezeyt.test:1234/foo/'))
    with pytest.raises(ValueError):
        saver.url_to_filename(
            url_parse("http://freezeyt.test:1234/second_page.html"))
Esempio n. 3
0
def test_custom_prefix_index():
    saver = FileSaver(base, url_parse('http://freezeyt.test:1234/foo/'))
    result = saver.url_to_filename(url_parse("http://freezeyt.test:1234/foo/"))
    assert result == base / 'index.html'
Esempio n. 4
0
def test_custom_prefix_fragment():
    saver = FileSaver(base, url_parse('http://freezeyt.test:1234/foo/'))
    result = saver.url_to_filename(
        url_parse("http://freezeyt.test:1234/foo/second_page.html#odkaz"))
    assert result == base / "second_page.html"
Esempio n. 5
0
def test_relative():
    saver = FileSaver(base, url_parse('http://localhost:8000/'))
    with pytest.raises(ValueError):
        saver.url_to_filename(url_parse("/a/b/c"))
Esempio n. 6
0
def test_scheme_different():
    saver = FileSaver(base, url_parse('http://localhost:8000/'))
    with pytest.raises(ValueError):
        saver.url_to_filename(
            url_parse("https://localhost:8000/second_page.html"))
Esempio n. 7
0
def test_fragment():
    saver = FileSaver(base, url_parse('http://localhost:8000/'))
    result = saver.url_to_filename(
        url_parse("http://localhost:8000/second_page.html#odkaz"))
    assert result == base / "second_page.html"
Esempio n. 8
0
def test_external_page():
    saver = FileSaver(base, url_parse('http://localhost:8000/'))
    with pytest.raises(ValueError):
        saver.url_to_filename(url_parse("http://python.cz"))
Esempio n. 9
0
def test_second_page():
    saver = FileSaver(base, url_parse('http://localhost:8000/'))
    result = saver.url_to_filename(url_parse("http://localhost:8000/second/"))
    assert result == base / "second/index.html"