Exemplo n.º 1
0
    def testNoExemptions_WithStateFilter(self):

        user = test_utils.CreateUser()
        test_utils.CreateSantaHosts(4, primary_user=user.nickname)

        actual_exms = model_utils.GetExemptionsForUser(
            user.email, state=constants.EXEMPTION_STATE.APPROVED)
        self.assertListEqual([], actual_exms)
Exemplo n.º 2
0
  def testSuccess(self):

    user = test_utils.CreateUser()
    host_id_1 = test_utils.CreateBit9Host(users=[user.nickname]).key.id()
    host_id_2 = test_utils.CreateSantaHost(primary_user=user.nickname).key.id()
    host_id_3 = test_utils.CreateSantaHost(primary_user='******').key.id()
    exm_1 = test_utils.CreateExemption(host_id_1).get()
    exm_2 = test_utils.CreateExemption(host_id_2).get()
    test_utils.CreateExemption(host_id_3)

    expected_exms = sorted([exm_1, exm_2])
    actual_exms = sorted(model_utils.GetExemptionsForUser(user.email))
    self.assertListEqual(expected_exms, actual_exms)
Exemplo n.º 3
0
  def testWithStateFilter(self):

    user = test_utils.CreateUser()
    host_id_1 = test_utils.CreateBit9Host(users=[user.nickname]).key.id()
    host_id_2 = test_utils.CreateSantaHost(primary_user=user.nickname).key.id()
    host_id_3 = test_utils.CreateSantaHost(primary_user='******').key.id()
    exm_1 = test_utils.CreateExemption(
        host_id_1, initial_state=_STATE.APPROVED).get()
    test_utils.CreateExemption(host_id_2, initial_state=_STATE.EXPIRED)
    test_utils.CreateExemption(host_id_3, initial_state=_STATE.APPROVED)

    actual_exms = sorted(
        model_utils.GetExemptionsForUser(user.email, state=_STATE.APPROVED))
    self.assertListEqual([exm_1], actual_exms)
Exemplo n.º 4
0
    def testNoExemptions_WithoutStateFilter(self):

        user = test_utils.CreateUser()
        test_utils.CreateSantaHosts(4, primary_user=user.nickname)

        self.assertListEqual([], model_utils.GetExemptionsForUser(user.email))