I m redirecting 403 error to a personal page. It works fine but test does not pass. I ve other tests that works fine.
this is my code for test: class TestErrorPages(TestBase):
def test_403_forbidden(self):
# create route to abort the request with the 403 Error
@self.app.route('/403')
def forbidden_error():
abort(403)
Test are not passed and error is:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 628, in run
testMethod()
File "/Users/xxxxx/PycharmProjects/setup/test.py", line 184, in test_403_forbidden
self.assertTrue("403 Error" in response.data)
TypeError: a bytes-like object is required, not 'str'
Where is my error ?
Aucun commentaire:
Enregistrer un commentaire