Пример #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"