customer/tests/e2e/rspay_test.go
2024-02-05 15:24:56 +03:00

40 lines
1.1 KiB
Go

package e2e
import (
"context"
"fmt"
"github.com/stretchr/testify/assert"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/client"
"penahub.gitlab.yandexcloud.net/pena-services/customer/tests/helpers"
"testing"
)
func TestGetAccount(t *testing.T) {
jwtUtil := helpers.InitializeJWT()
t.Run("rspay", func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
assert.NotPanics(t, func() {
token, tokenErr := jwtUtil.Create("6597babdd1ba7e2dbd32d7e3")
if isNoError := assert.NoError(t, tokenErr); !isNoError {
return
}
response, err := client.Post[interface{}, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
URL: "http://localhost:8000/wallet/rspay",
Headers: map[string]string{"Authorization": fmt.Sprintf("Bearer %s", token)},
})
if isNoError := assert.NoError(t, err); !isNoError {
return
}
if isNoRequestError := assert.Nil(t, response.Error); !isNoRequestError {
return
}
})
})
}