Test getting path without Content-Disposition.
This commit is contained in:
parent
b4a695d5b8
commit
33915b65cf
@ -23,9 +23,36 @@ Note that tests for parse_content_disposition are in their own
|
|||||||
test_content_disposition.py file.
|
test_content_disposition.py file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from PyQt5.QtCore import QUrl
|
||||||
|
|
||||||
from qutebrowser.browser import http
|
from qutebrowser.browser import http
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TestNoContentDisposition:
|
||||||
|
|
||||||
|
"""Test parse_content_disposition with no Content-Disposition header."""
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('url', ['http://example.com/path',
|
||||||
|
'http://example.com/foo/path'])
|
||||||
|
def test_url(self, stubs, url):
|
||||||
|
"""Test with a filename in the URL."""
|
||||||
|
reply = stubs.FakeNetworkReply(url=QUrl(url))
|
||||||
|
inline, filename = http.parse_content_disposition(reply)
|
||||||
|
assert inline
|
||||||
|
assert filename == 'path'
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('url', ['http://example.com',
|
||||||
|
'http://example.com/'])
|
||||||
|
def test_none(self, stubs, url):
|
||||||
|
"""Test with no filename at all."""
|
||||||
|
reply = stubs.FakeNetworkReply(url=QUrl(url))
|
||||||
|
inline, filename = http.parse_content_disposition(reply)
|
||||||
|
assert inline
|
||||||
|
assert filename == 'qutebrowser-download'
|
||||||
|
|
||||||
|
|
||||||
class TestParseContentType:
|
class TestParseContentType:
|
||||||
|
|
||||||
"""Test for parse_content_type."""
|
"""Test for parse_content_type."""
|
||||||
|
Loading…
Reference in New Issue
Block a user