-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #783 from frankrousseau/master
[tasks] Add a route to get all tasks for open projects
- Loading branch information
Showing
5 changed files
with
435 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,15 +290,21 @@ def generate_fixture_project_no_preview_tree(self): | |
) | ||
|
||
def generate_fixture_asset( | ||
self, name="Tree", description="Description Tree", asset_type_id=None | ||
self, name="Tree", | ||
description="Description Tree", | ||
asset_type_id=None, | ||
project_id=None, | ||
): | ||
if asset_type_id is None: | ||
asset_type_id = self.asset_type.id | ||
|
||
if project_id is None: | ||
project_id = self.project_id | ||
|
||
self.asset = Entity.create( | ||
name=name, | ||
description=description, | ||
project_id=self.project.id, | ||
project_id=project_id, | ||
entity_type_id=asset_type_id, | ||
) | ||
return self.asset | ||
|
@@ -500,7 +506,7 @@ def generate_fixture_user_vendor(self): | |
def generate_fixture_person( | ||
self, | ||
first_name="John", | ||
last_name="Doe", | ||
last_name="Doe", | ||
desktop_login="john.doe", | ||
email="[email protected]", | ||
): | ||
|
@@ -655,20 +661,23 @@ def generate_fixture_assigner(self): | |
return self.assigner | ||
|
||
def generate_fixture_task( | ||
self, name="Master", entity_id=None, task_type_id=None | ||
self, name="Master", entity_id=None, task_type_id=None, project_id=None | ||
): | ||
if entity_id is None: | ||
entity_id = self.asset.id | ||
|
||
if task_type_id is None: | ||
task_type_id = self.task_type.id | ||
|
||
if project_id is None: | ||
project_id = self.project.id | ||
|
||
start_date = fields.get_date_object("2017-02-20") | ||
due_date = fields.get_date_object("2017-02-28") | ||
real_start_date = fields.get_date_object("2017-02-22") | ||
self.task = Task.create( | ||
name=name, | ||
project_id=self.project.id, | ||
project_id=project_id, | ||
task_type_id=task_type_id, | ||
task_status_id=self.task_status.id, | ||
entity_id=entity_id, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -535,3 +535,63 @@ def test_update_entity_main_preview_from_task(self): | |
) | ||
entity = self.get("/data/entities/%s" % task["entity_id"]) | ||
self.assertEqual(entity["preview_file_id"], preview_file["id"]) | ||
|
||
def test_open_tasks(self): | ||
self.generate_fixture_task() | ||
task_id = str(self.task.id) | ||
self.task.update({"task_status_id": self.wip_status_id}) | ||
self.generate_fixture_asset_types() | ||
self.generate_fixture_asset_character() | ||
self.generate_fixture_task( | ||
entity_id=self.asset_character.id | ||
) | ||
|
||
animation_id = str(self.task_type_animation.id) | ||
self.generate_fixture_shot_task() | ||
self.generate_fixture_shot("SHOT_002") | ||
self.generate_fixture_shot_task() | ||
self.generate_fixture_shot("SHOT_003") | ||
self.generate_fixture_shot_task() | ||
|
||
tasks = self.get("/data/tasks/open-tasks") | ||
self.assertEqual(len(tasks["data"]), 5) | ||
|
||
self.generate_fixture_project_closed_status() | ||
self.generate_fixture_project_closed() | ||
asset = self.generate_fixture_asset( | ||
project_id=self.project_closed.id | ||
) | ||
self.generate_fixture_task( | ||
entity_id=asset.id, | ||
project_id=self.project_closed.id | ||
) | ||
tasks = self.get("/data/tasks/open-tasks") | ||
self.assertEqual(len(tasks["data"]), 5) | ||
|
||
self.generate_fixture_project_standard() | ||
self.generate_fixture_asset_standard() | ||
self.generate_fixture_task_standard() | ||
tasks = self.get("/data/tasks/open-tasks") | ||
self.assertEqual(len(tasks["data"]), 6) | ||
|
||
tasks = self.get("/data/tasks/open-tasks?project_id=%s" % self.project.id) | ||
self.assertEqual(len(tasks["data"]), 5) | ||
|
||
tasks = self.get("/data/tasks/open-tasks?project_id=%s&limit=3" % self.project.id) | ||
self.assertEqual(len(tasks["data"]), 3) | ||
|
||
tasks = self.get("/data/tasks/open-tasks?project_id=%s&limit=3&page=2" % self.project.id) | ||
self.assertEqual(len(tasks["data"]), 2) | ||
|
||
tasks = self.get("/data/tasks/open-tasks?task_type_id=%s" % animation_id) | ||
self.assertEqual(len(tasks["data"]), 3) | ||
|
||
tasks = self.get("/data/tasks/open-tasks?task_status_id=%s" % self.wip_status_id) | ||
self.assertEqual(len(tasks["data"]), 1) | ||
|
||
jane = self.generate_fixture_person("Jane", "Doe", "jane.doe", "[email protected]") | ||
data = {"person_id": jane.id} | ||
self.put("/actions/tasks/%s/assign" % task_id, data, 200) | ||
self.put("/actions/tasks/%s/assign" % self.shot_task.id, data, 200) | ||
tasks = self.get("/data/tasks/open-tasks?person_id=%s" % jane.id) | ||
self.assertEqual(len(tasks["data"]), 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.