def test_invalid_formdata_content_transfer_encoding(self): form = helpers.FormData() invalid_vals = [0, 0.1, {}, [], b'foo'] for invalid_val in invalid_vals: with self.assertRaises(TypeError): form.add_field('foo', 'bar', content_transfer_encoding=invalid_val)
def test_invalid_formdata_params2(self): with self.assertRaises(TypeError): helpers.FormData('as') # 2-char str is not allowed
def test_invalid_formdata_params(self): with self.assertRaises(TypeError): helpers.FormData('asdasf')
def test_invalid_formdata_filename(): form = helpers.FormData() invalid_vals = [0, 0.1, {}, [], b'foo'] for invalid_val in invalid_vals: with pytest.raises(TypeError): form.add_field('foo', 'bar', filename=invalid_val)
def test_invalid_formdata_params2(): with pytest.raises(TypeError): helpers.FormData('as') # 2-char str is not allowed
def test_invalid_formdata_params(): with pytest.raises(TypeError): helpers.FormData('asdasf')
def test_formdata_field_name_is_not_quoted(): form = helpers.FormData(quote_fields=False) form.add_field("emails[]", "*****@*****.**", content_type="multipart/form-data") res = b"".join(form("ascii")) assert b'name="emails[]"' in res