示例#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"))
示例#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"))
示例#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'
示例#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"
示例#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"))
示例#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"))
示例#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"
示例#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"))
示例#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"