Exemplo n.º 1
0
  def testForExistingMentor(self):
    profile = profile_utils.seedNDBProfile(
        self.program.key(), mentor_for=[self.organization_one.key])

    profile_logic.becomeMentorForOrg(profile, self.organization_one.key)

    # the profile should still be a mentor for organization one
    self.assertTrue(profile.is_mentor)
    self.assertIn(self.organization_one.key, profile.mentor_for)
Exemplo n.º 2
0
  def testForOrgAdminForAnotherOrgAdded(self):
    profile = profile_utils.seedNDBProfile(
        self.program.key(), admin_for=[self.organization_two.key])

    profile_logic.becomeMentorForOrg(profile, self.organization_one.key)

    # the profile should now be mentor for organization one
    self.assertTrue(profile.is_mentor)
    self.assertIn(self.organization_one.key, profile.mentor_for)
Exemplo n.º 3
0
  def testProfileNotAllowedToBecomeMentor(self):
    profile = profile_utils.seedSOCStudent(self.program)

    profile_logic.becomeMentorForOrg(profile, self.organization_one.key)

    # the profile should not become a mentor
    self.assertFalse(profile.is_mentor)
    self.assertNotIn(self.organization_one.key, profile.mentor_for)

    # the profile should still be a student
    self.assertTrue(profile.is_student)
Exemplo n.º 4
0
  def testMentorAdded(self):
    profile = profile_utils.seedNDBProfile(self.program.key())

    profile_logic.becomeMentorForOrg(profile, self.organization_one.key)

    # the profile should be a mentor for organization one
    self.assertTrue(profile.is_mentor)
    self.assertIn(self.organization_one.key, profile.mentor_for)

    # the profile is not a mentor for organization two
    self.assertNotIn(self.organization_two.key, profile.mentor_for)