def get(self, task_id): result = {} task = tasks_service.get_task(task_id) user_service.check_project_access(task["project_id"]) result = files_service.get_last_working_files_for_task(task["id"]) return result
def get(self, task_id): result = {} task = tasks_service.get_task(task_id) if not permissions.has_manager_permissions(): user_service.check_has_task_related(task["project_id"]) result = files_service.get_last_working_files_for_task(task["id"]) return result
def test_get_last_working_files_for_task(self): self.generate_fixture_working_file(name="main", revision=2) self.generate_fixture_working_file(name="main", revision=3) self.generate_fixture_working_file(name="main", revision=4) self.generate_fixture_working_file(name="main", revision=5) self.generate_fixture_working_file(name="hotfix", revision=1) self.generate_fixture_working_file(name="hotfix", revision=2) self.generate_fixture_working_file(name="hotfix", revision=3) working_files = files_service.get_last_working_files_for_task( self.task.id) self.assertEquals(working_files["main"]["revision"], 5) self.assertEquals(working_files["hotfix"]["revision"], 3)