-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaptcha_test.go
23 lines (19 loc) · 2.29 KB
/
captcha_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package gorecaptcha_test
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vloldik/gorecaptcha"
"google.golang.org/api/option"
)
func TestRecaptchaValidate(t *testing.T) {
token := "03AFcWeA5yoExtXbI6iXGPJ7SahFDCifS168gj08DVwsQJZUGOStyL1_k9nzq1RHAwbYfkKEm6MH0LSoBPjhDaZlUkJmdgsgCKRVYIFij_Dc-BO37WDmnhr-rf3iOlAPhc8yBFQDM7UyqiKYk813m6igtc2dCu3XBa5d5xuiDNtz0dirIJLHjyCPhKCrTR8o2QQfv3v9ty_BKDiYSGRr0hyAkQdblfrU26Tz8PEx7YPyi0oCwvh8t0Gc8phqhWJ1ftjl0q2CMoJgKV0_y8EBhlLKjS8qBWEAWNjDEQb6eCOBgASqFBA8aRWo8sRHFn5HQ253e14DqIhu2rmQFvrCv3o9K4m11plmgVDCXht4iJUK-PZVjgv35sEokSVAy8Va5Y8TlbLq3mkAuMNfR1aVjpyyGFj-QGtY8rJEibXBDnXUI2pO5WvUZHXWRVjVXz1eOpU-Zt9wWcc0xNHVD13iA-1U6xsbRDWZec39zou5NQgtLaGGjNXzUpS1AXJ2-5xxhmdIIPoJNF3qzer-794_HTilrsYin_GXU99m13gsvjoktRk9ef_NSb0Bnq8nDEnJOIuHSou41rVray8Nk2B6L5bjWj7JzFgRv3pGhHYezyrBVCks_8RGKwM_s-5V8Caxnf8oEzpfTmFmIoV7zjpI-j_H7fH8rJQa-GH_S7wlowj02CRPrrz2GPpCURzbYEuF9raGp9dSj8wBL5YMrS7qYQGL_h-KV1C1xXEQQwa04L2rlIF5Y7PYKLZRVgMo5QUx6GbOgphEs9cpo9P3a9A5KfKh1Os3VGZGfG3yWl8tQxj2cXG-wE0ke2TS_r0W2-uPxd8tOdmOqqLS1vFpG2dU_uHKeiJ1A7yeomHmP23uTAS-zUiP5e1mCWSxrIcTDiYkjdA0mEhhBIxyahMpvE0pS8Gy5_vY4b4kyD1yDmfrnL8dYPcAAI8ger72jyK8cVE2MIwv-5Tu12GnrRWmjKGJ4Bbd6YDv0smM5wcGscvLsu2-rAX-O9jDMvw1cN7-lSNQfPwawvhIVO7lw269dlfjaeA7zC2krAetES3zZBtMJSvfYCgNw1ru-DT-VAQvKWUmt1w_nHKs-1BLbETezBw2ZmMhsrvZ_UjAUSUIBcTVbgxnTX8i9txpTwtOIoqMUNc5Yxn2tZb17t9JGiTH2g6b810s7svgcavIVnw7EqYZ4aid19LkB6YuBUf_aAD9359jYFU7IUVR6LZy0nQWPTGwzjF-GB0fHjuu9k6VCAqOcqlnj3smlrVEP1pN8h8Ivu7vbWplJC8JK3DESj4zw085uG094LcHPRafU1ybbYa3atRnL28pBwm_kdADHM3lYyrPgKQGqIMlXQH-opMM35Bv_Us_7tkJ0sClJ_iB1PIFA7KgZY4hrmxxFGOdYu9pv6W7sER3XJWn9exkULNTGeOPMzgv0sFa_npq8Mvy5LGoEedz8xKklmHJEzGmUXWeIHelY3O8Ey7-qE1_Poql1ApNCD6CTAB8t39umD3k4UGJn9wJ6r_2LaXhq2LPH3OZQUehofpZew0kaQ_KBudIGQ8MyNpUI-WSGlIfYdidj3HNkoucydbj8XcumuazCZFaFVbgJkf2NrgsLt4P62LwiolIQRMAvKwSTSoQ_iQHX9mhXjQdeMVk2t34I5kQ6F-r6byF4GwkLvd5xeW6aQA9tgg5p1TfxyYOdgicqnig"
assessmentService := gorecaptcha.NewAssessmentService(option.WithAPIKey("AIzaSyCxKUljPkrkU04mdxt5WoNgvJXWWBai0JE"),
"recaptha-test-415214",
"6LduFn0pAAAAAIJIEVCbBADC8fdivGjr7dKP3XHV")
assessment, err := assessmentService.CreateAndValidateAssessment(context.Background(), token, "LOGIN", 0.4)
assert.NotNil(t, assessment)
assert.ErrorAs(t, err, &gorecaptcha.InvalidTokenError{})
fmt.Print(err.Error())
}