Beispiel #1
0
  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)
Beispiel #2
0
  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)
Beispiel #3
0
  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)
Beispiel #4
0
  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)
Beispiel #5
0
  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)