Advertisement
Guest User

Untitled

a guest
Aug 13th, 2023
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.42 KB | None | 0 0
  1. == FAILURES ===================================================
  2. _____________________________________________ test_login_functions _____________________________________________
  3.  
  4. yield_username = <function yield_username.<locals>._subfunction at 0x0000014651CB0700>
  5. username_form = 'fkpr[kfkuh'
  6. hashed_password_form = b'$2b$12$UQO2rkLIiz7MOtLEVp2ZROwVcvP95gw8aGty5WngakIGPEJkbdYH2'
  7. email_form = '[email protected]'
  8.  
  9.     def test_login_functions(yield_username, username_form, hashed_password_form, email_form):
  10.  
  11.         with app.test_request_context():
  12.             # example 1 I get the  unexpected output for /login route, IOW /login will not work because it is not redirecting
  13.  
  14.             # the output of the func is None because the db has values
  15.             form = yield_username(username_form, hashed_password_form, email_form)
  16.  
  17.  
  18. >           assert check_if_username_or_email_is_in_db(form) == None
  19.  
  20. app\tests\login_tests\test_login_functions.py:59:
  21. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
  22.  
  23. username_or_email_form = 'fkpr[kfkuh'
  24.  
  25.     def check_if_username_or_email_is_in_db(username_or_email_form):
  26.         '''
  27.        if the username or email is in the db the code works,
  28.        if not it redirects.
  29.  
  30.        This runs in the /login route.
  31.        The if statement checks if the query is empty/has no values in db.
  32.        '''
  33.         # makes it so db will run if empty list []
  34.  
  35.  
  36.         # Why do I need this and ca
  37.  
  38.  
  39.         user_db = UserTest.query.filter_by(username=username_or_email_form).first
  40.         print(user_db)
  41. >       print(user_db.username)
  42. E       AttributeError: 'function' object has no attribute 'username'
  43.  
  44. app\tests\login_tests\test_login_functions.py:30: AttributeError
  45. =============================================== warnings summary ===============================================
  46. app\__init__.py:82
  47.   C:\Users\user\OneDrive\Desktop\flaskcodeusethis\flaskblog2\app\__init__.py:82: UserWarning: The name 'auth' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.
  48.     app.register_blueprint(auth)
  49.  
  50. app\__init__.py:83
  51.   C:\Users\user\OneDrive\Desktop\flaskcodeusethis\flaskblog2\app\__init__.py:83: UserWarning: The name 'postinfo' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.
  52.     app.register_blueprint(postinfo)
  53.  
  54. app\__init__.py:84
  55.   C:\Users\user\OneDrive\Desktop\flaskcodeusethis\flaskblog2\app\__init__.py:84: UserWarning: The name 'mail' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error inuser Flask 2.1.
  56.     app.register_blueprint(mail)
  57.  
  58. app\__init__.py:85
  59.   C:\Users\user\OneDrive\Desktop\flaskcodeusethis\flaskblog2\app\__init__.py:85: UserWarning: The name 'payment' is already registered for this blueprint. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.
  60.     app.register_blueprint(payment)
  61.  
  62. app/tests/non_db_functions/test_routes.py::test_verified_email_post_get
  63.   C:\Users\user\Anaconda3\envs\py\lib\site-packages\itsdangerous\jws.py:201: DeprecationWarning: JWS support is deprecated and will be removed in ItsDangerous 2.1. Use a dedicated JWS/JWT library such as authlib.
  64.     super().__init__(secret_key, **kwargs)
  65.  
  66. -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.htm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement