Example #1
0
    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)

        self.assertEqual(expected_response, actual_response)
Example #2
0
    def test_list_tasks_with_user_not_involved(self):

        expected_response = messages.USER_NOT_INVOLVED_IN_THIS_MENTOR_RELATION, 401
        actual_response = TaskDAO.list_tasks(
            self.admin_user.id, self.mentorship_relation_w_second_user.id)

        self.assertEqual(expected_response, actual_response)
Example #3
0
    def test_list_tasks_with_non_existent_user(self):

        expected_response = messages.USER_DOES_NOT_EXIST, 404
        actual_response = TaskDAO.list_tasks(
            123123, self.mentorship_relation_w_second_user.id)

        self.assertEqual(expected_response, actual_response)
Example #4
0
    def test_list_empty_tasks(self):

        expected_response = []
        actual_response = TaskDAO.list_tasks(
            self.admin_user.id, self.mentorship_relation_without_first_user.id)

        self.assertEqual(expected_response, actual_response)
    def get(cls, request_id):
        """
        List all tasks from a mentorship relation.

        Input:
        1. Header: valid access token
        2. Path: ID of the mentorship relation for which tasks are to be
        displayed(request_id). The user must be involved in this relation.

        Returns:
        JSON array containing task details as objects is displayed on success.
        """

        # TODO check if user id is well parsed, if it is an integer

        user_id = get_jwt_identity()

        response = TaskDAO.list_tasks(user_id=user_id,
                                      mentorship_relation_id=request_id)

        if isinstance(response, tuple):
            return response

        return marshal(response, list_tasks_response_body), HTTPStatus.OK
Example #6
0
    def test_list_tasks_with_non_existent_relation(self):

        expected_response = messages.MENTORSHIP_RELATION_DOES_NOT_EXIST, 404
        actual_response = TaskDAO.list_tasks(self.first_user.id, 123123)

        self.assertEqual(expected_response, actual_response)