def test_15_reset_all_failcounters(self): self.setUp_user_realms() set_policy("reset_all", scope=SCOPE.AUTH, action=ACTION.RESETALLTOKENS) user = User(login="******", realm=self.realm1) pin1 = "pin1" pin2 = "pin2" token1 = init_token({ "serial": pin1, "pin": pin1, "type": "spass" }, user=user) token2 = init_token({ "serial": pin2, "pin": pin2, "type": "spass" }, user=user) token1.inc_failcount() token2.inc_failcount() token2.inc_failcount() self.assertEqual(token1.token.failcount, 1) self.assertEqual(token2.token.failcount, 2) g.policy_object = PolicyClass() g.audit_object = FakeAudit() g.client_ip = None options = {"g": g} r = reset_all_user_tokens(self.fake_check_token_list, [token1, token2], "pw", None, options=options, allow_reset_all_tokens=True, result=True) self.assertTrue(r) self.assertEqual(token1.token.failcount, 0) self.assertEqual(token2.token.failcount, 0) # Clean up remove_token(pin1) remove_token(pin2)
def test_15_reset_all_failcounters(self): self.setUp_user_realms() set_policy("reset_all", scope=SCOPE.AUTH, action=ACTION.RESETALLTOKENS) user = User(login="******", realm=self.realm1) pin1 = "pin1" pin2 = "pin2" token1 = init_token({"serial": pin1, "pin": pin1, "type": "spass"}, user=user) token2 = init_token({"serial": pin2, "pin": pin2, "type": "spass"}, user=user) token1.inc_failcount() token2.inc_failcount() token2.inc_failcount() self.assertEqual(token1.token.failcount, 1) self.assertEqual(token2.token.failcount, 2) g.policy_object = PolicyClass() g.audit_object = FakeAudit() options = {"g": g} r = reset_all_user_tokens(self.fake_check_token_list, [token1, token2], "pw", None, options=options, allow_reset_all_tokens=True, result=True) self.assertTrue(r) self.assertEqual(token1.token.failcount, 0) self.assertEqual(token2.token.failcount, 0) # Clean up remove_token(pin1) remove_token(pin2)