Describe the bug
PyJWT was updated approx a week ago which results in failing tests on the pull requests.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All tests should pass as expected
Here is the traceback of one test:
Traceback (most recent call last):
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context
self.dialect.do_execute(cursor, statement, parameters, context)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 567, in do_execute
cursor.execute(statement, parameters)
sqlite3.IntegrityError: UNIQUE constraint failed: users.email
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/kapil/Development/ANITA-B/mentorship-backend/tests/base_test_case.py", line 33, in setUp
db.session.commit()
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 163, in do
return getattr(self.registry(), name)(args, *kwargs)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1034, in commit
self.transaction.commit()
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 500, in commit
self._prepare_impl()
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 479, in _prepare_impl
self.session.flush()
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2471, in flush
self._flush(objects)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2605, in _flush
transaction.rollback(_capture_exception=True)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(exc_value, with_traceback=exc_tb)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 174, in raise_
raise exception
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2568, in _flush
flush_context.execute()
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 417, in execute
rec.execute(self)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 573, in execute
persistence.save_obj(
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 222, in save_obj
_emit_insert_statements(
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1044, in _emit_insert_statements
result = cached_connections[connection].execute(statement, params)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1003, in execute
return meth(self, multiparams, params)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1108, in _execute_clauseelement
ret = self._execute_context(
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self._handle_dbapi_exception(e, statement, parameters, cursor, context)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1446, in _handle_dbapi_exception
util.raise_(sqlalchemy_exception, with_traceback=exc_info[2], from_=e)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 174, in raise_
raise exception
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context
self.dialect.do_execute(cursor, statement, parameters, context)
File "/home/kapil/Development/ANITA-B/mentorship-backend/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 567, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: users.email
[SQL: INSERT INTO users (name, username, email, password_hash, registration_date, terms_and_conditions_checked, is_admin, is_email_verified, email_verification_date, current_mentorship_role, membership_status, bio, location, occupation, organization, slack_username, social_media_links, skills, interests, resume_url, photo_url, need_mentoring, available_to_mentor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: ('Admin', 'admin_username', '[email protected]', 'pbkdf2:sha256:150000$jyiosc68$5abd88d02645f5fefdaa0f80cdf246c61ce327bb130399bd74ab0782c8f7cadb', 1609078409.7204664, 1, 0, 0, None, None, None, None, None, None, None, None, None, None, None, None, None, 0, 0)]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
Errors in #935 and #838 due to this issue
@vj-codes @isabelcosta @PrashanthPuneriya please assign this issue to me
I solved this issue in #943 by updating the version of Flask-JWT in requirements.txt
@diananova good to see that you solve this issue. But this issue is no where related to the issue assigned to you. So, you can make a new PR for this change once this issue is approved
Assigning you @devkapilbansal
Happy coding!
@devkapilbansal thank you for creating this issue and providing information about the issues it caused and the stack trace. this is super well documented 馃憦