Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PS C:\Users\nmyle\OneDrive\Desktop\flaskcode\flaskblog2> python -m pytest
- ====================================================== test session starts ======================================================
- platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0
- rootdir: C:\Users\nmyle\OneDrive\Desktop\flaskcode\flaskblog2
- plugins: anyio-3.5.0
- collected 5 items
- app\tests\functional\test_routes.py ...F [ 80%]
- app\tests\unit\test_models.py . [100%]
- =========================================================== FAILURES ============================================================
- ______________________________________________________ test_verified_email ______________________________________________________
- token_client = <FlaskClient <Flask 'app'>>, new_user = <User (transient 2218406655504)>
- def test_verified_email(token_client, new_user):
- '''
- GIVEN a Flask application configured for testing
- WHEN the "/verified_email<token>" request is (GET) Also test the token is created and verified. email is sent
- THEN check that a token works.
- '''
- > response = token_client.get("/verified_email<token>", follow_redirects=True)
- app\tests\functional\test_routes.py:182:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1131: in get
- return self.open(*args, **kw)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\testing.py:222: in open
- return Client.open(
- ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1076: in open
- response = self.run_wsgi_app(request.environ, buffered=buffered)
- ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:945: in run_wsgi_app
- rv = run_wsgi_app(self.application, environ, buffered=buffered)
- ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1233: in run_wsgi_app
- app_rv = app(environ, start_response)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2464: in __call__
- return self.wsgi_app(environ, start_response)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2450: in wsgi_app
- response = self.handle_exception(e)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1867: in handle_exception
- reraise(exc_type, exc_value, tb)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\_compat.py:39: in reraise
- raise value
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2447: in wsgi_app
- response = self.full_dispatch_request()
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1952: in full_dispatch_request
- rv = self.handle_user_exception(e)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1821: in handle_user_exception
- reraise(exc_type, exc_value, tb)
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\_compat.py:39: in reraise
- raise value
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1950: in full_dispatch_request
- rv = self.dispatch_request()
- ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1936: in dispatch_request
- return self.view_functions[rule.endpoint](**req.view_args)
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- token = '<token>'
- @mail.route("/verified_email<token>", methods = ['POST', 'GET'])
- def verified_email(token):
- # why if I put a empty form in the app.mail.forms doesn't work?
- form = EmptyForm()
- if request.method == 'GET' : # and form.validate():
- > user = User.verify_token(token)
- E AttributeError: type object 'User' has no attribute 'verify_token'
- app\mail\routes.py:96: AttributeError
- ==================================================== short test summary info ====================================================
- FAILED app/tests/functional/test_routes.py::test_verified_email - AttributeError: type object 'User' has no attribute 'verify_t...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement