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)
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)
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)
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)