Example #1
0
  def testManyOrgAdmins(self):
    # seed  org admins for organization one
    for _ in range(5):
      profile_utils.seedNDBProfile(
          self.program.key(), admin_for=[self.organization_one.key])

    # seed  org admins for organization two
    for _ in range(3):
      profile_utils.seedNDBProfile(
          self.program.key(), admin_for=[self.organization_two.key])

    # all org admins for organization one should be returned
    number = profile_logic.countOrgAdmins(self.organization_one.key)
    self.assertEqual(number, 5)

    # all org admins for organization two should be returned
    number = profile_logic.countOrgAdmins(self.organization_two.key)
    self.assertEqual(number, 3)
Example #2
0
  def testNotActiveOrgAdmin(self):
    # seed invalid org admin for organization one
    profile_utils.seedNDBProfile(
        self.program.key(), admin_for=[self.organization_one.key],
        status=profile_model.Status.BANNED)

    # seed the other org admin who is active
    profile_utils.seedNDBProfile(
        self.program.key(), admin_for=[self.organization_one.key])

    # only active org admin counted
    org_admins = profile_logic.countOrgAdmins(self.organization_one.key)
    self.assertEqual(org_admins, 1)
Example #3
0
 def testNoOrgAdmin(self):
   number = profile_logic.countOrgAdmins(self.organization_one.key)
   self.assertEqual(number, 0)