Skip to content

Commit

Permalink
1.6.1dev: adapt unit tests to multipart 1.0.0+ and remove pin the mul…
Browse files Browse the repository at this point in the history
…tipart version on GitHub Actions (closes #13788)

git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17854 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Oct 3, 2024
1 parent 3a28b32 commit 43f72a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/requirements-minimum.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Jinja2
multipart<1.0.0; python_version>='3.11'
multipart; python_version>='3.11'
aiosmtpd; python_version>='3.10'
selenium!=4.10.0
pytidylib
Expand Down
2 changes: 1 addition & 1 deletion .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Jinja2
multipart<1.0.0; python_version>='3.11'
multipart; python_version>='3.11'
aiosmtpd; python_version>='3.10'
selenium!=4.10.0
pytidylib
Expand Down
14 changes: 8 additions & 6 deletions trac/web/tests/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_getfile(self):
file_ = req.args.getfile('attachment')

self.assertEqual(str(file_name, 'utf-8'), file_[0])
self.assertEqual(file_content, file_[1].getvalue())
self.assertEqual(file_content, file_[1].read())
self.assertEqual(len(file_content), file_[2])

def test_getfilelist(self):
Expand Down Expand Up @@ -327,9 +327,9 @@ def test_getfilelist(self):

self.assertEqual(2, len(file_))
self.assertEqual(str(file_name[0], 'utf-8'), file_[0][0])
self.assertEqual(file_content[0], file_[0][1].getvalue())
self.assertEqual(file_content[0], file_[0][1].read())
self.assertEqual(str(file_name[1], 'utf-8'), file_[1][0])
self.assertEqual(file_content[1], file_[1][1].getvalue())
self.assertEqual(file_content[1], file_[1][1].read())
self.assertEqual(len(file_content[1]), file_[1][2])

def test_require(self):
Expand Down Expand Up @@ -553,13 +553,15 @@ def test_post_with_unnamed_value(self):
environ = _make_environ(method='POST', **{
'wsgi.input': io.BytesIO(form_data),
'CONTENT_LENGTH': str(len(form_data)),
'CONTENT_TYPE': content_type
'CONTENT_TYPE': content_type,
})
req = Request(environ, None)

self.assertEqual('named value', req.args['foo'])
self.assertEqual([('foo', 'named value'), ('', 'name is empty'),
(None, 'unnamed value')], req.arg_list)
self.assertEqual([('foo', 'named value'), ('', 'name is empty')],
req.arg_list[:2])
self.assertIn(req.arg_list[2][0], [None, ''])
self.assertEqual('unnamed value', req.arg_list[2][1])

def _test_post_with_null_bytes(self, form_data):
boundary = '_BOUNDARY_'
Expand Down

0 comments on commit 43f72a7

Please sign in to comment.