mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
linters
This commit is contained in:
parent
5aafc222ad
commit
fe089902e1
@ -1053,21 +1053,28 @@ class RequestsTests(SimpleTestCase):
|
|||||||
"""
|
"""
|
||||||
MultiPartParser.parse() leaves request.FILES immutable.
|
MultiPartParser.parse() leaves request.FILES immutable.
|
||||||
"""
|
"""
|
||||||
payload = FakePayload("\r\n".join([
|
content_disposition = 'form-data; name="upload_file"; filename="asd.txt"'
|
||||||
'--boundary',
|
payload = FakePayload(
|
||||||
'Content-Disposition: form-data; name="upload_file"; filename="asd.txt"',
|
"\r\n".join(
|
||||||
'Content-Type: text/plain',
|
[
|
||||||
'',
|
"--boundary",
|
||||||
'asd',
|
f"Content-Disposition: {content_disposition}",
|
||||||
'--boundary--',
|
"Content-Type: text/plain",
|
||||||
]))
|
"",
|
||||||
request = WSGIRequest({
|
"asd",
|
||||||
'REQUEST_METHOD': 'POST',
|
"--boundary--",
|
||||||
'CONTENT_TYPE': 'multipart/form-data; boundary=boundary',
|
]
|
||||||
'CONTENT_LENGTH': len(payload),
|
)
|
||||||
'wsgi.input': payload,
|
)
|
||||||
})
|
request = WSGIRequest(
|
||||||
self.assertTrue('upload_file' in request.FILES)
|
{
|
||||||
|
"REQUEST_METHOD": "POST",
|
||||||
|
"CONTENT_TYPE": "multipart/form-data; boundary=boundary",
|
||||||
|
"CONTENT_LENGTH": len(payload),
|
||||||
|
"wsgi.input": payload,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.assertTrue("upload_file" in request.FILES)
|
||||||
self.assertFalse(request.FILES._mutable)
|
self.assertFalse(request.FILES._mutable)
|
||||||
|
|
||||||
def test_FILES_connection_error(self):
|
def test_FILES_connection_error(self):
|
||||||
|
@ -253,15 +253,15 @@ class ImmutableMultiValueDictTests(SimpleTestCase):
|
|||||||
def test_immutability(self):
|
def test_immutability(self):
|
||||||
q = MultiValueDict(mutable=False)
|
q = MultiValueDict(mutable=False)
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.__setitem__('something', 'bar')
|
q.__setitem__("something", "bar")
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.setlist('foo', ['bar'])
|
q.setlist("foo", ["bar"])
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.appendlist('foo', ['bar'])
|
q.appendlist("foo", ["bar"])
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.update({'foo': 'bar'})
|
q.update({"foo": "bar"})
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.pop('foo')
|
q.pop("foo")
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
q.popitem()
|
q.popitem()
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
@ -272,8 +272,8 @@ class ImmutableMultiValueDictTests(SimpleTestCase):
|
|||||||
q = MultiValueDict(mutable=False).copy()
|
q = MultiValueDict(mutable=False).copy()
|
||||||
with self.assertRaises(KeyError):
|
with self.assertRaises(KeyError):
|
||||||
q.__getitem__("foo")
|
q.__getitem__("foo")
|
||||||
q['name'] = 'john'
|
q["name"] = "john"
|
||||||
self.assertEqual(q['name'], 'john')
|
self.assertEqual(q["name"], "john")
|
||||||
|
|
||||||
|
|
||||||
class ImmutableListTests(SimpleTestCase):
|
class ImmutableListTests(SimpleTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user