Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- == FAILURES ===================================================
- _____________________________________________ test_login_functions _____________________________________________
- yield_username = <function yield_username.<locals>._subfunction at 0x0000014651CB0700>
- username_form = 'fkpr[kfkuh'
- hashed_password_form = b'$2b$12$UQO2rkLIiz7MOtLEVp2ZROwVcvP95gw8aGty5WngakIGPEJkbdYH2'
- email_form = '[email protected]'
- def test_login_functions(yield_username, username_form, hashed_password_form, email_form):
- with app.test_request_context():
- # example 1 I get the unexpected output for /login route, IOW /login will not work because it is not redirecting
- # the output of the func is None because the db has values
- form = yield_username(username_form, hashed_password_form, email_form)
- > assert check_if_username_or_email_is_in_db(form) == None
- app\tests\login_tests\test_login_functions.py:59:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- username_or_email_form = 'fkpr[kfkuh'
- def check_if_username_or_email_is_in_db(username_or_email_form):
- '''
- if the username or email is in the db the code works,
- if not it redirects.
- This runs in the /login route.
- The if statement checks if the query is empty/has no values in db.
- '''
- # makes it so db will run if empty list []
- # Why do I need this and ca
- user_db = UserTest.query.filter_by(username=username_or_email_form).first
- print(user_db)
- > print(user_db.username)
- E AttributeError: 'function' object has no attribute 'username'
- app\tests\login_tests\test_login_functions.py:30: AttributeError
- =============================================== warnings summary ===============================================
- app\__init__.py:82
- 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.
- app.register_blueprint(auth)
- app\__init__.py:83
- 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.
- app.register_blueprint(postinfo)
- app\__init__.py:84
- 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.
- app.register_blueprint(mail)
- app\__init__.py:85
- 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.
- app.register_blueprint(payment)
- app/tests/non_db_functions/test_routes.py::test_verified_email_post_get
- 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.
- super().__init__(secret_key, **kwargs)
- -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.htm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement