def testForExistingOrgAdmin(self): profile = profile_utils.seedNDBProfile( self.program.key(), admin_for=[self.organization_one.key]) profile_logic.becomeOrgAdminForOrg(profile, self.organization_one.key) # profile should still be an org admin for organization one self._assertOrgAdmin(profile, self.organization_one)
def testOrgAdminAdded(self): profile = profile_utils.seedNDBProfile(self.program.key()) profile_logic.becomeOrgAdminForOrg(profile, self.organization_one.key) # profile should become org admin for organization one self._assertOrgAdmin(profile, self.organization_one) # profile should not have any role for organization two self._assertNoRole(profile, self.organization_two)
def testProfileNotAllowedToBecomeOrgAdmin(self): profile = profile_utils.seedSOCStudent(self.program) profile_logic.becomeOrgAdminForOrg(profile, self.organization_one.key) # the profile should not become org admin for ogranization one self._assertNoRole(profile, self.organization_one) # the profile should still be a student self.assertTrue(profile.is_student)
def testOrgAdminForAnotherOrgAdded(self): profile = profile_utils.seedNDBProfile( self.program.key(), admin_for=[self.organization_two.key]) profile_logic.becomeOrgAdminForOrg(profile, self.organization_one.key) # profile should become org admin for organization one self._assertOrgAdmin(profile, self.organization_one) # profile should still be an org admin for organization two self._assertOrgAdmin(profile, self.organization_two)
def testMentorForAnotherOrgAdded(self): profile = profile_utils.seedNDBProfile( self.program.key(), mentor_for=[self.organization_two.key]) profile_logic.becomeOrgAdminForOrg(profile, self.organization_one.key) # profile should become org admin for organization one self._assertOrgAdmin(profile, self.organization_one) # profile should still be only mentor for organization two self.assertNotIn( self.organization_two.key, profile.admin_for) self.assertTrue(profile.is_mentor) self.assertIn(self.organization_two.key, profile.mentor_for)