Add compatibility with Werkzeug 2.1.0

issue11353
review356241003
This commit is contained in:
Nicolas Évrard
2022-03-31 13:43:36 +02:00
parent 27135a1bb7
commit 5e78e9bccc
2 changed files with 18 additions and 18 deletions
+12 -12
View File
@@ -6,7 +6,7 @@ import json
import unittest
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from werkzeug.wrappers import Response
from trytond.pool import Pool
from trytond.tests.test_tryton import DB_NAME, activate_module, drop_db
@@ -46,7 +46,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_no_field(self):
"Test GET data without field"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(self.data_url('res.user'), headers=self.auth_headers)
@@ -55,7 +55,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_one_field(self):
"Test GET data with one field"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('res.user'), headers=self.auth_headers,
@@ -66,7 +66,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_multiple_fields(self):
"Test GET data with multiple fields"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('res.user'), headers=self.auth_headers,
@@ -78,7 +78,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_language(self):
"Test GET data with language"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('ir.lang'), headers=self.auth_headers,
@@ -93,7 +93,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_size(self):
"Test GET data with size limit"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('ir.lang'), headers=self.auth_headers,
@@ -107,7 +107,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_page(self):
"Test GET data with page"
c = Client(app, BaseResponse)
c = Client(app, Response)
response0 = c.get(
self.data_url('ir.lang'), headers=self.auth_headers,
@@ -130,7 +130,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_encoding(self):
"Test GET data with encoding"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('ir.lang'), headers=self.auth_headers,
@@ -147,7 +147,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_delimiter(self):
"Test GET data with delimiter"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('res.user'), headers=self.auth_headers,
@@ -159,7 +159,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_quotechar(self):
"Test GET data with quotechar"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('res.user'), headers=self.auth_headers,
@@ -172,7 +172,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_no_header(self):
"Test GET data without header"
c = Client(app, BaseResponse)
c = Client(app, Response)
response = c.get(
self.data_url('res.user'), headers=self.auth_headers,
@@ -183,7 +183,7 @@ class RoutesTestCase(unittest.TestCase):
def test_data_locale_format(self):
"Test GET data in locale format"
c = Client(app, BaseResponse)
c = Client(app, Response)
response_std = c.get(
self.data_url('res.user'), headers=self.auth_headers,
+6 -6
View File
@@ -35,7 +35,7 @@ class WSGIAppTestCase(unittest.TestCase):
raise exception
client = Client(app)
(response, status, headers) = client.get('/willfail')
_ = client.get('/willfail')
spy.assert_called_once_with(app, sentinel.request, exception)
@@ -61,7 +61,7 @@ class WSGIAppTestCase(unittest.TestCase):
raise exception
client = Client(app)
(response, status, headers) = client.get('/willfail')
_ = client.get('/willfail')
spy1.assert_called_once_with(app, sentinel.request, exception)
spy2.assert_called_once_with(app, sentinel.request, exception)
@@ -85,7 +85,7 @@ class WSGIAppTestCase(unittest.TestCase):
raise exception
client = Client(app)
(response, status, headers) = client.get('/willfail')
_ = client.get('/willfail')
spy.assert_called_once_with(app, sentinel.request, exception)
@@ -106,10 +106,10 @@ class WSGIAppTestCase(unittest.TestCase):
raise self.TestException('foo')
client = Client(app)
(response, status, headers) = client.get('/willfail')
response = client.get('/willfail')
self.assertEqual(next(response), b'baz')
self.assertEqual(status, "418 I'M A TEAPOT")
self.assertEqual(next(response.response), b'baz')
self.assertEqual(response.status, "418 I'M A TEAPOT")
def suite():