Small style fixes for test_content_disposition.
This commit is contained in:
parent
1d4bb8d8da
commit
359b886ba0
@ -30,10 +30,8 @@ from qutebrowser.utils import log
|
|||||||
DEFAULT_NAME = 'qutebrowser-download'
|
DEFAULT_NAME = 'qutebrowser-download'
|
||||||
|
|
||||||
|
|
||||||
# These test cases are based on http://greenbytes.de/tech/tc2231/
|
class HeaderChecker:
|
||||||
|
|
||||||
|
|
||||||
class _HeaderChecker(object):
|
|
||||||
"""Helper class with some convenience methods to check filenames.
|
"""Helper class with some convenience methods to check filenames.
|
||||||
|
|
||||||
Attrs:
|
Attrs:
|
||||||
@ -75,11 +73,21 @@ class _HeaderChecker(object):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def header_checker(caplog, stubs):
|
def header_checker(caplog, stubs):
|
||||||
"""Fixture that provides a _HeaderChecker class for tests"""
|
"""Fixture that provides a HeaderChecker class for tests"""
|
||||||
return _HeaderChecker(caplog, stubs)
|
return HeaderChecker(caplog, stubs)
|
||||||
|
|
||||||
|
|
||||||
|
def test_att_double_space(header_checker):
|
||||||
|
"""'attachment' with double space in the filename."""
|
||||||
|
header_checker.check_filename('attachment; filename="foo bar.html"',
|
||||||
|
'foo bar.html')
|
||||||
|
|
||||||
|
|
||||||
|
# All following test cases are based on http://greenbytes.de/tech/tc2231/
|
||||||
|
|
||||||
|
|
||||||
class TestInline:
|
class TestInline:
|
||||||
|
|
||||||
"""Various tests relating to the "inline" disposition type.
|
"""Various tests relating to the "inline" disposition type.
|
||||||
|
|
||||||
See Section 4.2 of RFC 6266.
|
See Section 4.2 of RFC 6266.
|
||||||
@ -130,6 +138,7 @@ class TestInline:
|
|||||||
|
|
||||||
|
|
||||||
class TestAttachment:
|
class TestAttachment:
|
||||||
|
|
||||||
"""Various tests relating to the "attachment" disposition type.
|
"""Various tests relating to the "attachment" disposition type.
|
||||||
|
|
||||||
See Section 4.2 of RFC 6266.
|
See Section 4.2 of RFC 6266.
|
||||||
@ -620,6 +629,7 @@ class TestAttachment:
|
|||||||
|
|
||||||
|
|
||||||
class TestDispositionTypeExtension:
|
class TestDispositionTypeExtension:
|
||||||
|
|
||||||
"""Tests checking behavior for disposition type extensions.
|
"""Tests checking behavior for disposition type extensions.
|
||||||
|
|
||||||
They should be treated as "attachment", see Section 4.2 of RFC 6266.
|
They should be treated as "attachment", see Section 4.2 of RFC 6266.
|
||||||
@ -639,6 +649,7 @@ class TestDispositionTypeExtension:
|
|||||||
|
|
||||||
|
|
||||||
class TestCharacterSet:
|
class TestCharacterSet:
|
||||||
|
|
||||||
"""Various tests using the parameter value encoding defined in RFC 5987."""
|
"""Various tests using the parameter value encoding defined in RFC 5987."""
|
||||||
|
|
||||||
def test_attwithisofn2231iso(self, header_checker):
|
def test_attwithisofn2231iso(self, header_checker):
|
||||||
@ -815,6 +826,7 @@ class TestCharacterSet:
|
|||||||
|
|
||||||
|
|
||||||
class TestEncodingFallback:
|
class TestEncodingFallback:
|
||||||
|
|
||||||
"""Test the same parameter both in traditional and extended format.
|
"""Test the same parameter both in traditional and extended format.
|
||||||
|
|
||||||
This tests how the UA behaves when the same parameter name appears
|
This tests how the UA behaves when the same parameter name appears
|
||||||
@ -876,7 +888,8 @@ class TestEncodingFallback:
|
|||||||
|
|
||||||
|
|
||||||
class TestRFC2047Encoding:
|
class TestRFC2047Encoding:
|
||||||
"""These tests RFC 2047 style encoding.
|
|
||||||
|
"""Test RFC 2047 style encoding.
|
||||||
|
|
||||||
Note that according to Section 5 of RFC 2047, this encoding does not apply
|
Note that according to Section 5 of RFC 2047, this encoding does not apply
|
||||||
here: An 'encoded-word' MUST NOT appear within a 'quoted-string'., and An
|
here: An 'encoded-word' MUST NOT appear within a 'quoted-string'., and An
|
||||||
@ -908,12 +921,3 @@ class TestRFC2047Encoding:
|
|||||||
header_checker.check_filename(
|
header_checker.check_filename(
|
||||||
'attachment; filename="=?ISO-8859-1?Q?foo-=E4.html?="',
|
'attachment; filename="=?ISO-8859-1?Q?foo-=E4.html?="',
|
||||||
'=?ISO-8859-1?Q?foo-=E4.html?=')
|
'=?ISO-8859-1?Q?foo-=E4.html?=')
|
||||||
|
|
||||||
|
|
||||||
class TestOur:
|
|
||||||
"""Our own tests, not based on http://greenbytes.de/tech/tc2231/"""
|
|
||||||
|
|
||||||
def test_att_double_space(self, header_checker):
|
|
||||||
"""'attachment' with double space in the filename."""
|
|
||||||
header_checker.check_filename('attachment; filename="foo bar.html"',
|
|
||||||
'foo bar.html')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user