Skip to content

Commit c204643

Browse files
author
jomae
committed
1.6.1dev: remove uses of textwrap.dedent from web/tests/api.py (closes #13883)
git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17912 af82e41b-90c4-0310-8c96-b1721e28e2e2
1 parent 29ac082 commit c204643

File tree

1 file changed

+42
-43
lines changed

1 file changed

+42
-43
lines changed

trac/web/tests/api.py

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from datetime import datetime
1515
import io
1616
import os.path
17-
import textwrap
1817
import unittest
1918

2019
from trac import perm
@@ -533,21 +532,21 @@ def test_non_strict_qs(self):
533532

534533
def test_post_with_unnamed_value(self):
535534
boundary = '_BOUNDARY_'
536-
form_data = textwrap.dedent("""\
537-
--%(boundary)s\r\n\
538-
Content-Disposition: form-data; name="foo"\r\n\
539-
\r\n\
540-
named value\r\n\
541-
--%(boundary)s\r\n\
542-
Content-Disposition: form-data; name=""\r\n\
543-
\r\n\
544-
name is empty\r\n\
545-
--%(boundary)s\r\n\
546-
Content-Disposition: form-data\r\n\
547-
\r\n\
548-
unnamed value\r\n\
549-
--%(boundary)s--\r\n\
550-
""")
535+
form_data = (
536+
'--%(boundary)s\r\n'
537+
'Content-Disposition: form-data; name="foo"\r\n'
538+
'\r\n'
539+
'named value\r\n'
540+
'--%(boundary)s\r\n'
541+
'Content-Disposition: form-data; name=""\r\n'
542+
'\r\n'
543+
'name is empty\r\n'
544+
'--%(boundary)s\r\n'
545+
'Content-Disposition: form-data\r\n'
546+
'\r\n'
547+
'unnamed value\r\n'
548+
'--%(boundary)s--\r\n'
549+
)
551550
form_data = (form_data % {'boundary': boundary}).encode('utf-8')
552551
content_type = 'multipart/form-data; boundary="%s"' % boundary
553552
environ = _make_environ(method='POST', **{
@@ -584,39 +583,39 @@ def _test_post_with_null_bytes(self, form_data):
584583
self.fail("HTTPBadRequest not raised.")
585584

586585
def test_post_with_null_bytes_for_filename(self):
587-
form_data = textwrap.dedent("""\
588-
--%(boundary)s\r\n\
589-
Content-Disposition: form-data; name="attachment"; \
590-
filename="thefi\x00le.txt"\r\n\
591-
Content-Type: text/plain\r\n\
592-
\r\n\
593-
The file content.\r\n\
594-
--%(boundary)s\r\n\
595-
Content-Disposition: form-data; name="action"\r\n\
596-
\r\n\
597-
new\r\n\
598-
--%(boundary)s--\r\n\
599-
""")
586+
form_data = (
587+
'--%(boundary)s\r\n'
588+
'Content-Disposition: form-data; name="attachment"; '
589+
'filename="thefi\x00le.txt"\r\n'
590+
'Content-Type: text/plain\r\n'
591+
'\r\n'
592+
'The file content.\r\n'
593+
'--%(boundary)s\r\n'
594+
'Content-Disposition: form-data; name="action"\r\n'
595+
'\r\n'
596+
'new\r\n'
597+
'--%(boundary)s--\r\n'
598+
)
600599
self._test_post_with_null_bytes(form_data)
601600

602601
def test_post_with_null_bytes_for_name(self):
603-
form_data = textwrap.dedent("""\
604-
--%(boundary)s\r\n\
605-
Content-Disposition: form-data; name="acti\x00n"\r\n\
606-
\r\n\
607-
new\r\n\
608-
--%(boundary)s--\r\n\
609-
""")
602+
form_data = (
603+
'--%(boundary)s\r\n'
604+
'Content-Disposition: form-data; name="acti\x00n"\r\n'
605+
'\r\n'
606+
'new\r\n'
607+
'--%(boundary)s--\r\n'
608+
)
610609
self._test_post_with_null_bytes(form_data)
611610

612611
def test_post_with_null_bytes_for_value(self):
613-
form_data = textwrap.dedent("""\
614-
--%(boundary)s\r\n\
615-
Content-Disposition: form-data; name="action"\r\n\
616-
\r\n\
617-
ne\x00w\r\n\
618-
--%(boundary)s--\r\n\
619-
""")
612+
form_data = (
613+
'--%(boundary)s\r\n'
614+
'Content-Disposition: form-data; name="action"\r\n'
615+
'\r\n'
616+
'ne\x00w\r\n'
617+
'--%(boundary)s--\r\n'
618+
)
620619
self._test_post_with_null_bytes(form_data)
621620

622621
def test_qs_on_post(self):

0 commit comments

Comments
 (0)