def get_mission(cls, object_uuid, request): from sb_solutions.neo_models import Solution from sb_questions.neo_models import Question comment = Comment.nodes.get(object_uuid=object_uuid) if comment.parent_type == "solution": return Solution.get_mission(comment.parent_id, request) elif comment.parent_type == "question": return Question.get_mission(comment.parent_id, request) else: return None
def test_get_mission(self): solution = Solution(content='some test content').save() self.question.solutions.connect(solution) res = Solution.get_mission(solution.object_uuid) self.assertEqual(res['id'], self.mission.object_uuid)