def testForOrgAdmin(self): profile = profile_utils.seedNDBProfile( self.program.key(), admin_for=[self.organization.key]) # profile with an org admin role can still become an org admin can_become = profile_logic.canBecomeOrgAdmin(profile) self.assertTrue(can_become)
def testForInvalidProfile(self): profile = profile_utils.seedNDBProfile( self.program.key(), status=profile_model.Status.BANNED) # invalid profiles cannot become org admins can_become = profile_logic.canBecomeOrgAdmin(profile) self.assertFalse(can_become)
def testForOrgAdminForAnotherOrg(self): # seed another organization organization_two = org_utils.seedSOCOrganization(self.program.key()) profile = profile_utils.seedNDBProfile( self.program.key(), admin_for=[organization_two.key]) # profile with an org admin role can still become an org admin can_become = profile_logic.canBecomeOrgAdmin(profile) self.assertTrue(can_become)
def testForLoneProfile(self): profile = profile_utils.seedNDBProfile(self.program.key()) # profile with no roles can become org admins can_become = profile_logic.canBecomeOrgAdmin(profile) self.assertTrue(can_become)
def testForStudentProfile(self): profile = profile_utils.seedSOCStudent(self.program) # student profiles cannot become org admins can_become = profile_logic.canBecomeOrgAdmin(profile) self.assertFalse(can_become)