def test_05_do_request_fail(self): responses.add(responses.POST, "http://my.privacyidea.server/validate/check", body=json.dumps(self.fail_body), content_type="application/json") db_token = Token.query.filter(Token.serial == self.serial1).first() token = RemoteTokenClass(db_token) otpcount = token.check_otp("123456") self.assertTrue(otpcount == -1, otpcount)
def test_07_do_request_missing_config(self): responses.add(responses.POST, "http://my.privacyidea.server/validate/check", body=json.dumps(self.success_body), content_type="application/json") db_token = Token.query.filter(Token.serial == self.serial3).first() token = RemoteTokenClass(db_token) # Authentication will fail, since neither remote.serial nor remote.user otpcount = token.check_otp("123456") self.assertTrue(otpcount == -1, otpcount)
def test_04_do_request_success(self): responses.add(responses.POST, "http://my.privacyidea.server/validate/check", body=json.dumps(self.success_body), content_type="application/json") db_token = Token.query.filter(Token.serial == self.serial1).first() token = RemoteTokenClass(db_token) otpcount = token.check_otp("123456") self.assertTrue(otpcount > 0, otpcount)
def test_06_do_request_success_remote_user(self): # verify SSL set_privacyidea_config("remote.verify_ssl_certificate", True) responses.add(responses.POST, "http://my.privacyidea.server/validate/check", body=json.dumps(self.success_body), content_type="application/json") db_token = Token.query.filter(Token.serial == self.serial2).first() token = RemoteTokenClass(db_token) otpcount = token.check_otp("123456") self.assertTrue(otpcount > 0, otpcount)
def test_04_do_request_success(self): responses.add(responses.POST, "http://my.privacyidea.server/validate/check", body=json.dumps(self.success_body), content_type="application/json") db_token = Token.query.filter(Token.serial == self.serial1).first() token = RemoteTokenClass(db_token) otpcount = token.check_otp("123456") self.assertTrue(otpcount > 0, otpcount) remote_serial = token.get_tokeninfo("last_matching_remote_serial") self.assertEqual("PISP0000AB00", remote_serial)