Example #1
0
    def test_04_check_otp_success(self):
        responses.add(responses.POST, YUBICO_URL, body=self.success_body)

        db_token = Token.query.filter(Token.serial == self.serial1).first()
        token = YubicoTokenClass(db_token)
        otpcount = token.check_otp("vvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
        # Nonce and hash do not match
        self.assertTrue(otpcount == -2, otpcount)
    def test_04_check_otp_success(self):
        responses.add(responses.POST, YUBICO_URL,
                      body=json.dumps(self.success_body))

        db_token = Token.query.filter(Token.serial == self.serial1).first()
        token = YubicoTokenClass(db_token)
        otpcount = token.check_otp("vvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
        # Nonce and hash do not match
        self.assertTrue(otpcount == -2, otpcount)
Example #3
0
    def test_05_check_otp_fail(self):
        responses.add(responses.POST, YUBICO_URL, body=self.fail_body)

        db_token = Token.query.filter(Token.serial == self.serial1).first()
        token = YubicoTokenClass(db_token)

        otpcount = token.check_otp("vvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
        # Status != "OK".
        self.assertTrue(otpcount == -1, otpcount)
    def test_05_check_otp_fail(self):
        responses.add(responses.POST, YUBICO_URL,
                      body=json.dumps(self.fail_body))

        db_token = Token.query.filter(Token.serial == self.serial1).first()
        token = YubicoTokenClass(db_token)

        otpcount = token.check_otp("vvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
        # Status != "OK".
        self.assertTrue(otpcount == -1, otpcount)
    def test_04_check_otp_success_with_post_request(self):
        set_privacyidea_config("yubico.do_post", True)
        responses.add(responses.POST, YUBICO_URL,
                      body=self.success_body)

        db_token = Token.query.filter(Token.serial == self.serial1).first()
        token = YubicoTokenClass(db_token)
        otpcount = token.check_otp("vvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
        # Nonce and hash do not match
        self.assertTrue(otpcount == -2, otpcount)
        set_privacyidea_config("yubico.do_post", False)
 def test_07_check_otp_ID_wrong(self):
     db_token = Token.query.filter(Token.serial == self.serial1).first()
     token = YubicoTokenClass(db_token)
     otpcount = token.check_otp("Xvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
     self.assertTrue(otpcount == -1, otpcount)
 def test_06_check_otp_ID_too_short(self):
     db_token = Token.query.filter(Token.serial == self.serial1).first()
     token = YubicoTokenClass(db_token)
     otpcount = token.check_otp("vvbgidlg")
     self.assertTrue(otpcount == -1, otpcount)
Example #8
0
 def test_07_check_otp_ID_wrong(self):
     db_token = Token.query.filter(Token.serial == self.serial1).first()
     token = YubicoTokenClass(db_token)
     otpcount = token.check_otp("Xvbgidlghkhgndujklhhudbcuttkcklhvjktrjrt")
     self.assertTrue(otpcount == -1, otpcount)
Example #9
0
 def test_06_check_otp_ID_too_short(self):
     db_token = Token.query.filter(Token.serial == self.serial1).first()
     token = YubicoTokenClass(db_token)
     otpcount = token.check_otp("vvbgidlg")
     self.assertTrue(otpcount == -1, otpcount)