Advertisement
Guest User

Untitled

a guest
Sep 16th, 2022
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.12 KB | None | 0 0
  1. PS C:\Users\nmyle\OneDrive\Desktop\flaskcode\flaskblog2> python -m pytest
  2. ====================================================== test session starts ======================================================
  3. platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0
  4. rootdir: C:\Users\nmyle\OneDrive\Desktop\flaskcode\flaskblog2
  5. plugins: anyio-3.5.0
  6. collected 5 items
  7.  
  8. app\tests\functional\test_routes.py ...F                                                                                   [ 80%]
  9. app\tests\unit\test_models.py .                                                                                            [100%]
  10.  
  11. =========================================================== FAILURES ============================================================
  12. ______________________________________________________ test_verified_email ______________________________________________________
  13.  
  14. token_client = <FlaskClient <Flask 'app'>>, new_user = <User (transient 2218406655504)>
  15.  
  16.     def test_verified_email(token_client, new_user):
  17.         '''
  18.        GIVEN a Flask application configured for testing
  19.        WHEN the "/verified_email<token>" request is (GET) Also test the token is created and verified. email is sent
  20.        THEN check that a token works.
  21.        '''
  22.    
  23.    
  24. >       response = token_client.get("/verified_email<token>", follow_redirects=True)
  25.  
  26. app\tests\functional\test_routes.py:182:
  27. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  28. ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1131: in get
  29.     return self.open(*args, **kw)
  30. ..\..\..\..\anaconda3.1\lib\site-packages\flask\testing.py:222: in open
  31.     return Client.open(
  32. ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1076: in open
  33.     response = self.run_wsgi_app(request.environ, buffered=buffered)
  34. ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:945: in run_wsgi_app
  35.     rv = run_wsgi_app(self.application, environ, buffered=buffered)
  36. ..\..\..\..\anaconda3.1\lib\site-packages\werkzeug\test.py:1233: in run_wsgi_app
  37.     app_rv = app(environ, start_response)
  38. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2464: in __call__
  39.     return self.wsgi_app(environ, start_response)
  40. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2450: in wsgi_app
  41.     response = self.handle_exception(e)
  42. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1867: in handle_exception
  43.     reraise(exc_type, exc_value, tb)
  44. ..\..\..\..\anaconda3.1\lib\site-packages\flask\_compat.py:39: in reraise
  45.     raise value
  46. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:2447: in wsgi_app
  47.     response = self.full_dispatch_request()
  48. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1952: in full_dispatch_request
  49.     rv = self.handle_user_exception(e)
  50. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1821: in handle_user_exception
  51.     reraise(exc_type, exc_value, tb)
  52. ..\..\..\..\anaconda3.1\lib\site-packages\flask\_compat.py:39: in reraise
  53.     raise value
  54. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1950: in full_dispatch_request
  55.     rv = self.dispatch_request()
  56. ..\..\..\..\anaconda3.1\lib\site-packages\flask\app.py:1936: in dispatch_request
  57.     return self.view_functions[rule.endpoint](**req.view_args)
  58. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  59.  
  60. token = '<token>'
  61.  
  62.     @mail.route("/verified_email<token>", methods = ['POST', 'GET'])
  63.     def verified_email(token):
  64.         # why if I put a empty form in the app.mail.forms doesn't work?
  65.         form = EmptyForm()
  66.         if request.method == 'GET' : # and form.validate():
  67. >           user = User.verify_token(token)
  68. E           AttributeError: type object 'User' has no attribute 'verify_token'
  69.  
  70. app\mail\routes.py:96: AttributeError
  71.  
  72. ==================================================== short test summary info ====================================================
  73. 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