Fixed #30677 -- Improved error message for urlencode() and Client when None is passed as data.

This commit is contained in:
swatantra 2019-08-09 13:49:18 +05:30 committed by Mariusz Felisiak
parent c1b26c77a9
commit 73ac9e3f04
4 changed files with 13 additions and 12 deletions

View file

@ -61,8 +61,8 @@ class ClientTest(TestCase):
def test_get_data_none(self):
msg = (
'Cannot encode None in a query string. Did you mean to pass an '
'empty string or omit the value?'
"Cannot encode None for key 'value' in a query string. Did you "
"mean to pass an empty string or omit the value?"
)
with self.assertRaisesMessage(TypeError, msg):
self.client.get('/get_view/', {'value': None})
@ -102,8 +102,8 @@ class ClientTest(TestCase):
def test_post_data_none(self):
msg = (
'Cannot encode None as POST data. Did you mean to pass an empty '
'string or omit the value?'
"Cannot encode None for key 'value' as POST data. Did you mean "
"to pass an empty string or omit the value?"
)
with self.assertRaisesMessage(TypeError, msg):
self.client.post('/post_view/', {'value': None})