Skip to content

Commit

Permalink
refactor: remove is_done from get /tasks api response (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
saikirankv authored and isabelcosta committed Apr 18, 2021
1 parent f08a7ba commit 6cd5cd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/api/models/mentorship_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def add_models_to_namespace(api_namespace):
},
)


user_dashboard_user_details = Model(
"User details for dashboard",
{
Expand Down
3 changes: 0 additions & 3 deletions app/api/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ def add_models_to_namespace(api_namespace):
"description": fields.String(
required=True, description="Mentorship relation task description"
),
"is_done": fields.Boolean(
required=True, description="Mentorship relation task is done indication"
),
"created_at": fields.Float(
required=True, description="Task creation date in UNIX timestamp format"
),
Expand Down
4 changes: 0 additions & 4 deletions tests/user_journey/test_happy_path_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ def test_happy_path_1(self):
new_task = tasks[0]
task_id = new_task["id"]
task_description = new_task["description"]
task_state = new_task["is_done"]
task_completed_at = new_task["completed_at"]

self.assertIsNotNone(task_id)
self.assertFalse(task_state)
self.assertIsNone(task_completed_at)
self.assertEqual(self.test_description, task_description)

Expand All @@ -191,11 +189,9 @@ def test_happy_path_1(self):
updated_task = tasks[0]
updated_task_id = updated_task["id"]
updated_task_description = updated_task["description"]
updated_task_state = updated_task["is_done"]
updated_task_completed_at = updated_task["completed_at"]

self.assertEqual(task_id, updated_task_id)
self.assertTrue(updated_task_state)
self.assertIsNotNone(updated_task_completed_at)
self.assertEqual(self.test_description, updated_task_description)

Expand Down
11 changes: 8 additions & 3 deletions tests/users/test_dao_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest

from flask_restx import marshal
from app.api.models.mentorship_relation import list_tasks_response_body
from app.api.email_utils import generate_confirmation_token
from app.api.dao.user import UserDAO, DashboardRelationResponseModel
from datetime import timedelta, datetime
Expand Down Expand Up @@ -164,8 +165,12 @@ def test_dao_get_user_dashboard(self):
"pending": [],
},
},
"tasks_todo": [self.tasks_list_1.find_task_by_id(1)],
"tasks_done": [self.tasks_list_1.find_task_by_id(2)],
"tasks_todo": [
marshal(self.tasks_list_1.find_task_by_id(1), list_tasks_response_body)
],
"tasks_done": [
marshal(self.tasks_list_1.find_task_by_id(2), list_tasks_response_body)
],
}
actual_response = UserDAO.get_user_dashboard(self.first_user.id)
self.assertEqual(actual_response, expected_response)
Expand Down

0 comments on commit 6cd5cd4

Please sign in to comment.