verification/tests/e2e/get_verify_user_test.go

34 lines
810 B
Go

package e2e
import (
"encoding/json"
"fmt"
"github.com/gofiber/fiber/v2"
"github.com/stretchr/testify/assert"
"penahub.gitlab.yandexcloud.net/backend/verification/internal/models"
"penahub.gitlab.yandexcloud.net/backend/verification/tests/helpers"
"testing"
)
func Test_Get_Verify_User(t *testing.T) {
url := "http://localhost:8080/verification"
client := fiber.AcquireClient()
token, err := helpers.CreateJwt("64e53ed187392e122e5d3d50")
assert.NoError(t, err)
agent := client.Get(url)
agent.Set("Authorization", fmt.Sprintf("Bearer %s", token))
statusCode, respBody, errs := agent.Bytes()
if len(errs) > 0 {
assert.NoError(t, errs[0])
}
assert.Equal(t, 200, statusCode)
var resp models.Verification
err = json.Unmarshal(respBody, &resp)
assert.NoError(t, err)
fmt.Println(resp)
}