Esempio n. 1
0
  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)
Esempio n. 2
0
  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)
Esempio n. 3
0
  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)
Esempio n. 4
0
  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)
Esempio n. 5
0
  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)