Example #1
0
  def testForOrgAdmin(self):
    # make the profile an org admin for organization
    self.mentor.admin_for = [self.organization.key]
    self.mentor.put()

    profile_logic.resignAsMentorForOrg(self.mentor, self.organization.key)

    # the profile should still be a mentor because of being org admin
    self.assertTrue(self.mentor.is_mentor)
    self.assertIn(self.organization.key, self.mentor.mentor_for)
Example #2
0
  def testForMentorWithProject(self):
    # seed a project for organization one and set a mentor
    student = profile_utils.seedSOCStudent(self.program)
    project_utils.seedProject(
        student, self.program.key(),
        org_key=self.organization.key, mentor_key=self.mentor.key)

    profile_logic.resignAsMentorForOrg(self.mentor, self.organization.key)

    # the profile should still be a mentor because of the project
    self.assertTrue(self.mentor.is_mentor)
    self.assertIn(self.organization.key, self.mentor.mentor_for)
Example #3
0
  def testForMentorForTwoOrgs(self):
    # seed another organization
    organization_two = org_utils.seedSOCOrganization(self.program.key())

    # make the profile a mentor for organization two
    self.mentor.mentor_for.append(organization_two.key)
    self.mentor.put()

    profile_logic.resignAsMentorForOrg(self.mentor, self.organization.key)

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

    # the profile should still be a mentor for organization_two
    self.assertTrue(self.mentor.is_mentor)
    self.assertIn(organization_two.key, self.mentor.mentor_for)
Example #4
0
  def testForMentorWithoutProject(self):
    profile_logic.resignAsMentorForOrg(self.mentor, self.organization.key)

    # the profile is not a mentor anymore
    self.assertFalse(self.mentor.is_mentor)
    self.assertNotIn(self.organization.key, self.mentor.mentor_for)