Exemplo n.º 1
0
 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):
     quest = Quest(owner_username=self.pleb.username).save()
     quest.owner.connect(self.pleb)
     mission = Mission(owner_username=self.pleb.username).save()
     quest.missions.connect(mission)
     mission.associated_with.connect(self.question)
     res = Question.get_mission(self.question.object_uuid)
     self.assertEqual(res['id'], mission.object_uuid)
     mission.delete()
     quest.delete()