Fix test failures with Django 4.x

The wsgi.input environment variable is expected to be a stream.

Closes-Bug: #2034952
Change-Id: I602449245b30d5375251bd7138f538f28068a16a
This commit is contained in:
Corey Bryant 2023-09-08 14:25:00 -04:00
parent db1859f74e
commit b5b22dd183
1 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,7 @@
import collections.abc
import copy
import io
import logging
import os
import socket
@ -200,7 +201,8 @@ class TestCase(django_test.TestCase):
The expected number of messages can be specified per message type.
Usage would look like ``self.assertMessageCount(success=1)``.
"""
temp_req = self.client.request(**{'wsgi.input': None})
stream = wsgi.LimitedStream(io.BytesIO(), 2)
temp_req = self.client.request(**{'wsgi.input': stream})
temp_req.COOKIES = self.client.cookies
storage = default_storage(temp_req)
messages = []