Ejemplo n.º 1
0
  def testMentorWithProposal(self):
    # seed a new proposal and assign our mentor
    student = profile_utils.seedSOCStudent(self.program)
    proposal_utils.seedProposal(
        student.key, self.program.key(),
        org_key=self.organization_one.key, mentor_key=self.mentor.key)

    # mentor is involved in organization one because of a proposal
    can_resign = profile_logic.canResignAsMentorForOrg(
        self.mentor, self.organization_one.key)
    self.assertFalse(can_resign)

    # add mentor role for organization two
    self.mentor.mentor_for.append(self.organization_two.key)

    # mentor is not involved in organization two
    can_resign = profile_logic.canResignAsMentorForOrg(
        self.mentor, self.organization_two.key)
    self.assertTrue(can_resign)
Ejemplo n.º 2
0
 def testNotMentorForOrg(self):
   # profile is not a mentor for organization two
   with self.assertRaises(ValueError):
     profile_logic.canResignAsMentorForOrg(
         self.mentor, self.organization_two.key)
Ejemplo n.º 3
0
 def testMentorCanResign(self):
   # mentor is not involved in organization one
   can_resign = profile_logic.canResignAsMentorForOrg(
       self.mentor, self.organization_one.key)
   self.assertTrue(can_resign)