def test_01_enroll_yubikey_and_auth(self): db_token = Token(self.serial1, tokentype="yubikey") db_token.save() token = YubikeyTokenClass(db_token) token.set_otpkey(self.otpkey) token.set_otplen(48) token.set_pin(self.pin) token.save() self.assertTrue(token.token.serial == self.serial1, token) self.assertTrue(token.token.tokentype == "yubikey", token.token) self.assertTrue(token.type == "yubikey", token) class_prefix = token.get_class_prefix() self.assertTrue(class_prefix == "UBAM", class_prefix) self.assertTrue(token.get_class_type() == "yubikey", token) # Test a bunch of otp values old_r = 0 for otp in self.valid_otps: r = token.check_otp(otp) # check if the newly returned counter is bigger than the old one self.assertTrue(r > old_r, (r, old_r)) old_r = r # test otp_exist r = token.check_otp_exist(self.further_otps[0]) self.assertTrue(r > old_r, (r, old_r))