You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then when assertRedirects tries to access the Flask instance at self.app it instead gets the FlaskClient instance and crashes as below.
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/Users/bistenes/Code/socos/jive/server/src/tests/test_pages.py", line 118, in test_logs_in_user
self.assertRedirects(rv, '/manage')
File "/Users/bistenes/Code/socos/jive/server/src/lib/flask_testing/utils.py", line 278, in assertRedirects
server_name = self.app.config.get('SERVER_NAME') or 'localhost'
AttributeError: 'FlaskClient' object has no attribute 'config'
I'm pretty surprised this wasn't a problem before 0.6.0 -- you would think that resolving self.app elsewhere, e.g. for self.app.get(...) would also be a problem, but it apparently wasn't. The obvious solution is to not name the test client self.app, but rather, say, self.client.
This is mostly a request for documentation -- somewhere it should advise against doing this. It's also, of course, a note to those running into this confusing error in the future. Actual code change is probably not called for here.
The text was updated successfully, but these errors were encountered:
When the test client is named
self.app
, i.e. you have a situation likeThen when
assertRedirects
tries to access the Flask instance atself.app
it instead gets theFlaskClient
instance and crashes as below.I'm pretty surprised this wasn't a problem before 0.6.0 -- you would think that resolving
self.app
elsewhere, e.g. forself.app.get(...)
would also be a problem, but it apparently wasn't. The obvious solution is to not name the test clientself.app
, but rather, say,self.client
.This is mostly a request for documentation -- somewhere it should advise against doing this. It's also, of course, a note to those running into this confusing error in the future. Actual code change is probably not called for here.
The text was updated successfully, but these errors were encountered: