diff --git a/app/api/dao/admin.py b/app/api/dao/admin.py index 2f82b3a3b..c11732c82 100644 --- a/app/api/dao/admin.py +++ b/app/api/dao/admin.py @@ -39,7 +39,6 @@ def assign_new_user(user_id: int, data: Dict[str, str]): new_admin_user = UserModel.find_by_id(new_admin_user_id) if new_admin_user: - if new_admin_user.is_admin: return messages.USER_IS_ALREADY_AN_ADMIN, HTTPStatus.BAD_REQUEST @@ -82,7 +81,6 @@ def revoke_admin_user(user_id: int, data: Dict[str, str]): return messages.USER_NOT_FOUND, HTTPStatus.NOT_FOUND if new_admin_user: - if not new_admin_user.is_admin: return messages.USER_IS_NOT_AN_ADMIN, HTTPStatus.BAD_REQUEST diff --git a/app/api/dao/user.py b/app/api/dao/user.py index 15d6f4e0d..dfbd422d7 100644 --- a/app/api/dao/user.py +++ b/app/api/dao/user.py @@ -89,7 +89,6 @@ def delete_user(user_id: int): # check if this user is the only admin if user.is_admin: - admins_list_count = len(UserModel.get_all_admins()) if admins_list_count <= UserDAO.MIN_NUMBER_OF_ADMINS: return messages.USER_CANT_DELETE, HTTPStatus.BAD_REQUEST diff --git a/app/api/resources/mentorship_relation.py b/app/api/resources/mentorship_relation.py index 839bc4da8..b9df86e55 100644 --- a/app/api/resources/mentorship_relation.py +++ b/app/api/resources/mentorship_relation.py @@ -113,7 +113,6 @@ def post(cls): @staticmethod def is_valid_data(data): - # Verify if request body has required fields if "mentor_id" not in data: return messages.MENTOR_ID_FIELD_IS_MISSING diff --git a/app/api/resources/task.py b/app/api/resources/task.py index 6160e390a..baa41a8f4 100644 --- a/app/api/resources/task.py +++ b/app/api/resources/task.py @@ -74,7 +74,6 @@ def post(cls, relation_id): @staticmethod def is_valid_data(data): - if "description" not in data: return messages.DESCRIPTION_FIELD_IS_MISSING diff --git a/app/database/models/mentorship_relation.py b/app/database/models/mentorship_relation.py index 9054bd06f..d9976c6cb 100644 --- a/app/database/models/mentorship_relation.py +++ b/app/database/models/mentorship_relation.py @@ -69,7 +69,6 @@ def __init__( notes, tasks_list, ): - self.action_user_id = action_user_id self.mentor = mentor_user self.mentee = mentee_user # same as mentee_user.mentee_relations.append(self) @@ -99,7 +98,6 @@ def json(self): @classmethod def find_by_id(cls, _id) -> "MentorshipRelationModel": - """Returns the mentorship that has the passed id. Args: _id: The id of a mentorship. diff --git a/requirements.txt b/requirements.txt index 7ac2d2f31..7da37800c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,54 @@ +alembic==1.11.3 +aniso8601==9.0.1 APScheduler==3.7.0 -coverage==5.5 -Flask==1.0.2 +attrs==23.1.0 +blinker==1.6.2 +cfgv==3.2.0 +click==7.1.2 +coverage==7.2.7 +distlib==0.3.7 +filelock==3.12.2 +Flask==1.1.4 Flask-JWT-Extended==3.25.0 Flask-Mail==0.9.1 Flask-Migrate==2.5.3 -flask-restx==0.5.0 +flask-restx==1.1.0 +Flask-SQLAlchemy==2.5.1 Flask-Testing==0.8.1 +greenlet==2.0.2 gunicorn==20.0.4 -psycopg2-binary==2.8.6 +identify==2.5.24 +idna==3.4 +importlib-metadata==6.7.0 +importlib-resources==5.12.0 +itsdangerous==1.1.0 +Jinja2==2.11.3 +jsonschema==4.17.3 +jsonschema-specifications==0.1.3 +Mako==1.2.4 +MarkupSafe==2.0.1 +multidict==6.0.4 +mypy-extensions==1.0.0 +nodeenv==1.8.0 +packaging==23.1 +pathspec==0.11.2 +pkgutil_resolve_name==1.3.10 +platformdirs==3.10.0 +pre-commit==2.21.0 +psycopg2-binary==2.9.6 +PyJWT==1.7.1 +pyrsistent==0.19.3 python-dotenv==0.18.0 +pytz==2023.3 +PyYAML==6.0.1 +referencing==0.8.9 six==1.11.0 -pre-commit +SQLAlchemy==1.4.0 +tomli==2.0.1 +typed-ast==1.5.5 +typing_extensions==4.7.1 +tzlocal==2.1 +virtualenv==20.24.3 +Werkzeug==1.0.1 +yarl==1.9.2 +zipp==3.15.0 diff --git a/tests/admin/test_dao.py b/tests/admin/test_dao.py index 69d8e6637..f4c8e7366 100644 --- a/tests/admin/test_dao.py +++ b/tests/admin/test_dao.py @@ -16,7 +16,6 @@ class TestAdminDao(BaseTestCase): """ def test_dao_assign_new_admin_valid_user(self): - dao = AdminDAO() user = UserModel( @@ -44,7 +43,6 @@ def test_dao_assign_new_admin_valid_user(self): """ def test_dao_assign_new_admin_by_normal_user(self): - dao = AdminDAO() user = UserModel( @@ -73,7 +71,6 @@ def test_dao_assign_new_admin_by_normal_user(self): """ def test_dao_assign_admin_role_to_non_existing_user(self): - dao = AdminDAO() data = dict(user_id=123) @@ -89,7 +86,6 @@ def test_dao_assign_admin_role_to_non_existing_user(self): """ def test_dao_assign_admin_role_to_admin_user(self): - dao = AdminDAO() user = UserModel( @@ -122,7 +118,6 @@ def test_dao_assign_admin_role_to_admin_user(self): """ def test_dao_assign_admin_role_to_myself(self): - dao = AdminDAO() user = UserModel( @@ -155,7 +150,6 @@ def test_dao_assign_admin_role_to_myself(self): """ def test_dao_revoke_admin_role_to_valid_user(self): - dao = AdminDAO() user = UserModel( @@ -184,7 +178,6 @@ def test_dao_revoke_admin_role_to_valid_user(self): """ def test_dao_revoke_admin_role_by_non_admin_user(self): - dao = AdminDAO() user = UserModel( @@ -211,7 +204,6 @@ def test_dao_revoke_admin_role_by_non_admin_user(self): """ def test_dao_revoke_admin_role_to_non_existing_user(self): - dao = AdminDAO() data = dict(user_id=123) @@ -227,7 +219,6 @@ def test_dao_revoke_admin_role_to_non_existing_user(self): """ def test_dao_revoke_admin_role_to_non_admin_user(self): - dao = AdminDAO() user = UserModel( diff --git a/tests/cron_job_functions/test_mentorship_completion_cron.py b/tests/cron_job_functions/test_mentorship_completion_cron.py index ac8cabfb5..983b5fb14 100644 --- a/tests/cron_job_functions/test_mentorship_completion_cron.py +++ b/tests/cron_job_functions/test_mentorship_completion_cron.py @@ -15,7 +15,6 @@ class TestCompleteMentorshipRelationCronFunction(BaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver @@ -105,7 +104,6 @@ def get_test_app(self): @patch("run.application", side_effect=get_test_app) def test_complete_mentorship_relations_accepted(self, get_test_app_fn): - self.assertEqual( MentorshipRelationState.ACCEPTED, self.mentorship_relation_1.state ) diff --git a/tests/mentorship_relation/relation_base_setup.py b/tests/mentorship_relation/relation_base_setup.py index da53ab76b..6726e8c7d 100644 --- a/tests/mentorship_relation/relation_base_setup.py +++ b/tests/mentorship_relation/relation_base_setup.py @@ -5,7 +5,6 @@ class MentorshipRelationBaseTestCase(BaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_api_cancel_relation.py b/tests/mentorship_relation/test_api_cancel_relation.py index 588bf12b3..01345a4aa 100644 --- a/tests/mentorship_relation/test_api_cancel_relation.py +++ b/tests/mentorship_relation/test_api_cancel_relation.py @@ -13,7 +13,6 @@ class TestCancelMentorshipRelationApi(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_api_delete_request.py b/tests/mentorship_relation/test_api_delete_request.py index 406d2a422..8a52e44c7 100644 --- a/tests/mentorship_relation/test_api_delete_request.py +++ b/tests/mentorship_relation/test_api_delete_request.py @@ -13,7 +13,6 @@ class TestDeleteMentorshipRequestApi(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_api_list_relations.py b/tests/mentorship_relation/test_api_list_relations.py index 63d818eb6..c38222e20 100644 --- a/tests/mentorship_relation/test_api_list_relations.py +++ b/tests/mentorship_relation/test_api_list_relations.py @@ -15,7 +15,6 @@ class TestListMentorshipRelationsApi(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_api_reject_request.py b/tests/mentorship_relation/test_api_reject_request.py index 1dbba8f57..3c5538719 100644 --- a/tests/mentorship_relation/test_api_reject_request.py +++ b/tests/mentorship_relation/test_api_reject_request.py @@ -13,7 +13,6 @@ class TestRejectMentorshipRequestApi(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_dao_accept_request.py b/tests/mentorship_relation/test_dao_accept_request.py index 3077f6a8a..d0f3b0d60 100644 --- a/tests/mentorship_relation/test_dao_accept_request.py +++ b/tests/mentorship_relation/test_dao_accept_request.py @@ -14,7 +14,6 @@ class TestMentorshipRelationAcceptRequestDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_dao_cancel_relation.py b/tests/mentorship_relation/test_dao_cancel_relation.py index 084e92076..f4644b51d 100644 --- a/tests/mentorship_relation/test_dao_cancel_relation.py +++ b/tests/mentorship_relation/test_dao_cancel_relation.py @@ -13,7 +13,6 @@ class TestMentorshipRelationListingDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_dao_creation.py b/tests/mentorship_relation/test_dao_creation.py index 2b0d74c54..35ad71c5b 100644 --- a/tests/mentorship_relation/test_dao_creation.py +++ b/tests/mentorship_relation/test_dao_creation.py @@ -12,7 +12,6 @@ class TestMentorshipRelationCreationDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database def setUp(self): super().setUp() @@ -160,7 +159,6 @@ def test_dao_create_mentorship_relation_with_non_existent_mentee(self): self.assertIsNone(query_mentorship_relation) def test_dao_create_mentorship_relation_with_mentee_already_in_relation(self): - self.mentorship_relation = MentorshipRelationModel( action_user_id=self.admin_user.id, mentor_user=self.admin_user, @@ -196,7 +194,6 @@ def test_dao_create_mentorship_relation_with_mentee_already_in_relation(self): self.assertTrue(1, len(query_mentorship_relations)) def test_dao_create_mentorship_relation_with_mentor_already_in_relation(self): - self.mentorship_relation = MentorshipRelationModel( action_user_id=self.admin_user.id, mentor_user=self.admin_user, diff --git a/tests/mentorship_relation/test_dao_delete_request.py b/tests/mentorship_relation/test_dao_delete_request.py index a8ddcd7f9..d78580afe 100644 --- a/tests/mentorship_relation/test_dao_delete_request.py +++ b/tests/mentorship_relation/test_dao_delete_request.py @@ -13,7 +13,6 @@ class TestMentorshipRelationDeleteDAO(BaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver @@ -69,7 +68,6 @@ def setUp(self): db.session.commit() def test_dao_delete_non_existing_mentorship_request(self): - result = MentorshipRelationDAO.delete_request(self.first_user.id, 123) self.assertEqual( @@ -83,7 +81,6 @@ def test_dao_delete_non_existing_mentorship_request(self): ) def test_dao_sender_does_not_exist(self): - result = MentorshipRelationDAO.delete_request(123, self.mentorship_relation.id) self.assertEqual((messages.USER_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND), result) @@ -94,7 +91,6 @@ def test_dao_sender_does_not_exist(self): ) def test_dao_receiver_tries_to_delete_mentorship_request(self): - result = MentorshipRelationDAO.delete_request( self.second_user.id, self.mentorship_relation.id ) @@ -126,7 +122,6 @@ def test_dao_sender_delete_mentorship_request(self): ) def test_dao_user_not_involved_tries_to_delete_mentorship_request(self): - result = MentorshipRelationDAO.delete_request( self.admin_user.id, self.mentorship_relation.id ) diff --git a/tests/mentorship_relation/test_dao_list_relations.py b/tests/mentorship_relation/test_dao_list_relations.py index d21745333..c8d95ba96 100644 --- a/tests/mentorship_relation/test_dao_list_relations.py +++ b/tests/mentorship_relation/test_dao_list_relations.py @@ -12,7 +12,6 @@ class TestListMentorshipRelationsDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database def setUp(self): super().setUp() @@ -63,7 +62,6 @@ def setUp(self): db.session.commit() def test_dao_list_past_mentorship_relations(self): - result = MentorshipRelationDAO.list_past_mentorship_relations( user_id=self.first_user.id ) @@ -74,7 +72,6 @@ def test_dao_list_past_mentorship_relations(self): self.assertEqual(expected_response, result[0]) def test_dao_list_current_mentorship_relation(self): - result = MentorshipRelationDAO.list_current_mentorship_relation( user_id=self.first_user.id ) @@ -91,7 +88,6 @@ def test_dao_list_non_existing_current_mentorship_relation(self): self.assertEqual(expected_response, result) def test_dao_list_pending_mentorship_relation(self): - result = MentorshipRelationDAO.list_pending_mentorship_relations( user_id=self.first_user.id ) diff --git a/tests/mentorship_relation/test_dao_listing.py b/tests/mentorship_relation/test_dao_listing.py index 190f968b7..0e85c4e6c 100644 --- a/tests/mentorship_relation/test_dao_listing.py +++ b/tests/mentorship_relation/test_dao_listing.py @@ -13,7 +13,6 @@ class TestMentorshipRelationListingDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database def setUp(self): super().setUp() diff --git a/tests/mentorship_relation/test_dao_reject_mentorship_request.py b/tests/mentorship_relation/test_dao_reject_mentorship_request.py index 3e3776830..55cbc965d 100644 --- a/tests/mentorship_relation/test_dao_reject_mentorship_request.py +++ b/tests/mentorship_relation/test_dao_reject_mentorship_request.py @@ -13,7 +13,6 @@ class TestMentorshipRelationListingDAO(MentorshipRelationBaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/mentorship_relation/test_database_model.py b/tests/mentorship_relation/test_database_model.py index 886823f40..5cb5b40db 100644 --- a/tests/mentorship_relation/test_database_model.py +++ b/tests/mentorship_relation/test_database_model.py @@ -19,7 +19,6 @@ class TestMentorshipRelationModel(BaseTestCase): - # Setup consists of adding 2 users into the database def setUp(self): db.create_all() diff --git a/tests/tasks/tasks_base_setup.py b/tests/tasks/tasks_base_setup.py index 3d1f0faa2..945434aa6 100644 --- a/tests/tasks/tasks_base_setup.py +++ b/tests/tasks/tasks_base_setup.py @@ -10,7 +10,6 @@ class TasksBaseTestCase(BaseTestCase): - # Setup consists of adding 2 users into the database # User 1 is the mentorship relation requester = action user # User 2 is the receiver diff --git a/tests/tasks/test_api_complete_task.py b/tests/tasks/test_api_complete_task.py index 4eb6ebf8c..9b67814f3 100644 --- a/tests/tasks/test_api_complete_task.py +++ b/tests/tasks/test_api_complete_task.py @@ -22,7 +22,6 @@ def test_complete_task_api_resource_non_auth(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_complete_task_api(self): - relation = MentorshipRelationModel.find_by_id( self.mentorship_relation_w_second_user.id ) diff --git a/tests/tasks/test_api_create_task.py b/tests/tasks/test_api_create_task.py index 1f92c0f3f..21b93f0f9 100644 --- a/tests/tasks/test_api_create_task.py +++ b/tests/tasks/test_api_create_task.py @@ -69,7 +69,6 @@ def test_create_task_api_resource_non_auth(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_full_task_creation_api(self): - non_existent_task = self.tasks_list_1.find_task_by_id(3) self.assertIsNone(non_existent_task) diff --git a/tests/tasks/test_api_delete_task.py b/tests/tasks/test_api_delete_task.py index 18661d8bb..e69d40444 100644 --- a/tests/tasks/test_api_delete_task.py +++ b/tests/tasks/test_api_delete_task.py @@ -47,7 +47,6 @@ def test_delete_task_api_w_user_not_belonging_to_mentorship_relation_2(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_full_task_deletion_api(self): - existent_task = self.tasks_list_1.find_task_by_id(2) self.assertIsNotNone(existent_task) diff --git a/tests/tasks/test_api_list_tasks.py b/tests/tasks/test_api_list_tasks.py index c057ae055..b0274f4bb 100644 --- a/tests/tasks/test_api_list_tasks.py +++ b/tests/tasks/test_api_list_tasks.py @@ -23,7 +23,6 @@ def test_list_tasks_api_resource_non_auth(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_list_tasks_api_first_mentorship_relation(self): - auth_header = get_test_request_header(self.first_user.id) expected_response = marshal(self.tasks_list_1.tasks, list_tasks_response_body) actual_response = self.client.get( @@ -37,7 +36,6 @@ def test_list_tasks_api_first_mentorship_relation(self): self.assertEqual(expected_response, json.loads(actual_response.data)) def test_list_tasks_api_second_mentorship_relation(self): - auth_header = get_test_request_header(self.first_user.id) expected_response = marshal(self.tasks_list_2.tasks, list_tasks_response_body) actual_response = self.client.get( @@ -50,7 +48,6 @@ def test_list_tasks_api_second_mentorship_relation(self): self.assertEqual(expected_response, json.loads(actual_response.data)) def test_list_tasks_api_w_user_not_belonging_to_mentorship_relation(self): - auth_header = get_test_request_header(self.second_user.id) expected_response = messages.USER_NOT_INVOLVED_IN_THIS_MENTOR_RELATION actual_response = self.client.get( @@ -63,7 +60,6 @@ def test_list_tasks_api_w_user_not_belonging_to_mentorship_relation(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_list_tasks_api_mentorship_relation_without_tasks(self): - auth_header = get_test_request_header(self.second_user.id) expected_response = [] actual_response = self.client.get( diff --git a/tests/tasks/test_dao_complete_task.py b/tests/tasks/test_dao_complete_task.py index 2029ffe88..bc79cbac6 100644 --- a/tests/tasks/test_dao_complete_task.py +++ b/tests/tasks/test_dao_complete_task.py @@ -33,7 +33,6 @@ def test_achieve_achieved_task(self): self.assertEqual(expected_response, actual_response) def test_achieve_not_existent_task(self): - expected_response = messages.TASK_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND actual_response = TaskDAO.complete_task( self.first_user.id, self.mentorship_relation_w_second_user.id, 123123 diff --git a/tests/tasks/test_dao_create_task.py b/tests/tasks/test_dao_create_task.py index e484dfe44..802caac4a 100644 --- a/tests/tasks/test_dao_create_task.py +++ b/tests/tasks/test_dao_create_task.py @@ -9,7 +9,6 @@ class TestListTasksDao(TasksBaseTestCase): def test_create_task(self): - expected_response = ( messages.TASK_WAS_CREATED_SUCCESSFULLY, HTTPStatus.CREATED, @@ -31,7 +30,6 @@ def test_create_task(self): self.assertEqual(self.test_is_done, new_task.get("is_done")) def test_create_task_with_non_existing_mentorship_relation(self): - expected_response = ( messages.MENTORSHIP_RELATION_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND, @@ -46,7 +44,6 @@ def test_create_task_with_non_existing_mentorship_relation(self): self.assertEqual(expected_response, actual_response) def test_create_task_with_mentorship_relation_non_accepted_state(self): - expected_response = ( messages.UNACCEPTED_STATE_RELATION, HTTPStatus.FORBIDDEN, @@ -62,7 +59,6 @@ def test_create_task_with_mentorship_relation_non_accepted_state(self): self.assertEqual(expected_response, actual_response) def test_create_task_with_user_not_involved_in_mentorship(self): - expected_response = ( messages.USER_NOT_INVOLVED_IN_THIS_MENTOR_RELATION, HTTPStatus.FORBIDDEN, diff --git a/tests/tasks/test_dao_delete_task.py b/tests/tasks/test_dao_delete_task.py index 45783bb08..15c5f1d8d 100644 --- a/tests/tasks/test_dao_delete_task.py +++ b/tests/tasks/test_dao_delete_task.py @@ -8,7 +8,6 @@ class TestDeleteTasksDao(TasksBaseTestCase): def test_delete_existent_task(self): - expected_response = messages.TASK_WAS_DELETED_SUCCESSFULLY, HTTPStatus.OK first_task_id = 1 @@ -42,7 +41,6 @@ def test_delete_task_from_non_existing_relation(self): self.assertEqual(expected_response, actual_response) def test_delete_non_existent_task(self): - expected_response = messages.TASK_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND actual_response = TaskDAO.delete_task( self.first_user.id, self.mentorship_relation_w_second_user.id, 123123 diff --git a/tests/tasks/test_dao_list_tasks.py b/tests/tasks/test_dao_list_tasks.py index fcff6346d..4844f4a64 100644 --- a/tests/tasks/test_dao_list_tasks.py +++ b/tests/tasks/test_dao_list_tasks.py @@ -8,7 +8,6 @@ class TestListTasksDao(TasksBaseTestCase): def test_list_tasks(self): - expected_response = self.tasks_list_1.tasks actual_response = TaskDAO.list_tasks( self.first_user.id, self.mentorship_relation_w_second_user.id @@ -17,7 +16,6 @@ def test_list_tasks(self): self.assertEqual(expected_response, actual_response) def test_list_empty_tasks(self): - expected_response = [] actual_response = TaskDAO.list_tasks( self.admin_user.id, self.mentorship_relation_without_first_user.id @@ -26,7 +24,6 @@ def test_list_empty_tasks(self): self.assertEqual(expected_response, actual_response) def test_list_tasks_with_non_existent_relation(self): - expected_response = ( messages.MENTORSHIP_RELATION_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND, @@ -36,7 +33,6 @@ def test_list_tasks_with_non_existent_relation(self): self.assertEqual(expected_response, actual_response) def test_list_tasks_with_non_existent_user(self): - expected_response = messages.USER_DOES_NOT_EXIST, HTTPStatus.NOT_FOUND actual_response = TaskDAO.list_tasks( 123123, self.mentorship_relation_w_second_user.id @@ -45,7 +41,6 @@ def test_list_tasks_with_non_existent_user(self): self.assertEqual(expected_response, actual_response) def test_list_tasks_with_user_not_involved(self): - expected_response = ( messages.USER_NOT_INVOLVED_IN_THIS_MENTOR_RELATION, HTTPStatus.UNAUTHORIZED, diff --git a/tests/tasks/test_tasks_list_database_model.py b/tests/tasks/test_tasks_list_database_model.py index 27a2500d3..708bff677 100644 --- a/tests/tasks/test_tasks_list_database_model.py +++ b/tests/tasks/test_tasks_list_database_model.py @@ -23,7 +23,6 @@ def setUp(self): self.tasks_list_1.add_task(self.test_description_1, self.now_timestamp) def test_tasks_list_creation(self): - tasks_list_one = TasksListModel.query.filter_by(id=1).first() self.assertIsNotNone(tasks_list_one) @@ -32,7 +31,6 @@ def test_tasks_list_creation(self): self.assertEqual(1, tasks_list_one.id) def test_add_task_to_tasks_list(self): - tasks_list_one = TasksListModel.query.filter_by(id=1).first() self.assertEqual([], tasks_list_one.tasks) @@ -62,7 +60,6 @@ def test_add_task_to_tasks_list(self): self.assertEqual([expected_task_1, expected_task_2], tasks_list_one.tasks) def test_remove_task_from_tasks_list(self): - tasks_list_one = TasksListModel.query.filter_by(id=1).first() self.assertEqual([], tasks_list_one.tasks) @@ -84,7 +81,6 @@ def test_remove_task_from_tasks_list(self): self.assertEqual([], tasks_list_one.tasks) def test_remove_task_from_pre_filled_list(self): - tasks_list_two = TasksListModel.query.filter_by(id=2).first() expected_task_1 = dict( @@ -104,12 +100,10 @@ def test_remove_task_from_pre_filled_list(self): self.assertTrue(tasks_list_two.is_empty()) def test_empty_tasks_list_function(self): - tasks_list_one = TasksListModel.query.filter_by(id=1).first() self.assertTrue(tasks_list_one.is_empty()) def test_find_task_by_id(self): - tasks_list_one = TasksListModel.query.filter_by(id=1).first() expected_task_1 = dict( @@ -142,7 +136,6 @@ def test_find_task_by_id(self): self.assertIsNone(found_task_3) def test_update_task(self): - tasks_list_one = TasksListModel.query.filter_by(id=2).first() self.assertIsNotNone(tasks_list_one) diff --git a/tests/test_app_config.py b/tests/test_app_config.py index c16f6e614..4934f659d 100644 --- a/tests/test_app_config.py +++ b/tests/test_app_config.py @@ -36,7 +36,6 @@ def test_app_testing_config(self): ) def test_get_bd_uri_function(self): - expected_result = "db_type_example://db_user_example:db_password_example@db_endpoint_example/db_name_example" actual_result = BaseConfig.build_db_uri( db_type_arg="db_type_example", diff --git a/tests/user_journey/test_happy_path_1.py b/tests/user_journey/test_happy_path_1.py index dad631545..2ed156acd 100644 --- a/tests/user_journey/test_happy_path_1.py +++ b/tests/user_journey/test_happy_path_1.py @@ -57,7 +57,6 @@ def setUp(self): self.test_description = "A nice task description" def test_happy_path_1(self): - mentor_auth_header = get_test_request_header(self.mentor.id) mentee_auth_header = get_test_request_header(self.mentee.id) diff --git a/tests/user_journey/test_rejection_path.py b/tests/user_journey/test_rejection_path.py index 2bcef3c83..6164931e3 100644 --- a/tests/user_journey/test_rejection_path.py +++ b/tests/user_journey/test_rejection_path.py @@ -60,7 +60,6 @@ def setUp(self): self.test_description = "A request for mentorship" def test_rejection_path(self): - mentor_auth_header = get_test_request_header(self.mentor.id) mentee_auth_header = get_test_request_header(self.mentee.id) diff --git a/tests/users/test_api_authentication.py b/tests/users/test_api_authentication.py index b158292c1..65f36d984 100644 --- a/tests/users/test_api_authentication.py +++ b/tests/users/test_api_authentication.py @@ -15,7 +15,6 @@ class TestProtectedApi(BaseTestCase): - # User 1 which has email verified def setUp(self): super().setUp() diff --git a/tests/users/test_api_login.py b/tests/users/test_api_login.py index 876ff682d..3684cc656 100644 --- a/tests/users/test_api_login.py +++ b/tests/users/test_api_login.py @@ -18,7 +18,6 @@ class TestUserLoginApi(BaseTestCase): - # Setup consists of adding 2 users into the database # User 1 does not have email verified # User 2 has email verified @@ -47,7 +46,6 @@ def setUp(self): def test_user_login_invalid_credentials(self): with self.client: - response = self.client.post( "/login", data=json.dumps( diff --git a/tests/users/test_api_refresh.py b/tests/users/test_api_refresh.py index 3e406e7c0..d956c9bcf 100644 --- a/tests/users/test_api_refresh.py +++ b/tests/users/test_api_refresh.py @@ -13,7 +13,6 @@ class TestUserRefreshApi(BaseTestCase): - # User 1 which has email verified def setUp(self): super().setUp() diff --git a/tests/users/test_api_update_user.py b/tests/users/test_api_update_user.py index b57ac7f7c..de836d9a5 100644 --- a/tests/users/test_api_update_user.py +++ b/tests/users/test_api_update_user.py @@ -24,7 +24,6 @@ def test_update_user_api_resource_non_auth(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_update_username_already_taken(self): - self.first_user = UserModel( name=user1["name"], email=user1["email"], @@ -51,7 +50,6 @@ def test_update_username_already_taken(self): self.assertDictEqual(expected_response, json.loads(actual_response.data)) def test_update_username_not_taken(self): - self.first_user = UserModel( name=user1["name"], email=user1["email"], @@ -80,7 +78,6 @@ def test_update_username_not_taken(self): self.assertEqual(user1_new_username, self.first_user.username) def test_update_username_invalid_length(self): - self.first_user = UserModel( name=user1["name"], email=user1["email"], @@ -120,7 +117,6 @@ def test_update_username_invalid_length(self): self.assertEqual(user1["username"], self.first_user.username) def test_update_availability_to_mentor_more_than_once(self): - self.first_user = UserModel( name=user1["name"], email=user1["email"], @@ -168,7 +164,6 @@ def test_update_availability_to_mentor_more_than_once(self): ) def test_update_availability_to_be_mentee_to_false(self): - self.first_user = UserModel( name=user1["name"], email=user1["email"], diff --git a/tests/users/test_dao_update_user.py b/tests/users/test_dao_update_user.py index 7a0352104..6bd9a3046 100644 --- a/tests/users/test_dao_update_user.py +++ b/tests/users/test_dao_update_user.py @@ -9,7 +9,6 @@ class TestUpdateUserDao(BaseTestCase): def test_dao_update_user(self): - self.assertIsNotNone(self.admin_user.name) self.assertIsNone(self.admin_user.bio) self.assertIsNone(self.admin_user.location) @@ -50,7 +49,6 @@ def test_dao_update_user(self): self.assertEqual("good_photo_url", self.admin_user.photo_url) def test_update_fields_with_empty_data(self): - name_before_update = self.admin_user.name self.assertIsNotNone(self.admin_user.name) @@ -96,7 +94,6 @@ def test_update_fields_with_empty_data(self): self.assertIsNone(self.admin_user.photo_url) def test_update_user_that_does_not_exist(self): - user = UserModel.query.filter_by(id=2).first() self.assertIsNone(user) diff --git a/tests/users/test_database_model.py b/tests/users/test_database_model.py index 92cd7b2b5..42be5f37a 100644 --- a/tests/users/test_database_model.py +++ b/tests/users/test_database_model.py @@ -16,7 +16,6 @@ class TestAdminUserModel(BaseTestCase): def test_is_first_user_admin(self): - user = UserModel.query.filter_by(email=test_admin_user["email"]).first() self.assertTrue(user is not None) self.assertTrue(user.id is not None) @@ -31,7 +30,6 @@ def test_is_first_user_admin(self): ) def test_second_user_cannot_be_admin(self): - user = UserModel( name="User1", email="user1@email.com",