customer/tests/e2e/сurrencies_test.go
2024-02-01 16:48:29 +03:00

35 lines
986 B
Go

package e2e_test
import (
"context"
"fmt"
"github.com/stretchr/testify/assert"
"net/http"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/client"
"testing"
)
func TestCurrencies(t *testing.T) {
t.Run("Получение текущих доступных курсов", func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
assert.NotPanics(t, func() {
responseGetCurrencies, errCurrencies := client.Get[[]models.CurrencyList, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
URL: "http://localhost:8000/currencies",
})
if isNoError := assert.NoError(t, errCurrencies); !isNoError {
return
}
if isNoRequestError := assert.Nil(t, responseGetCurrencies.Error); !isNoRequestError {
return
}
fmt.Println(responseGetCurrencies.Body)
assert.Equal(t, http.StatusOK, responseGetCurrencies.StatusCode)
})
})
}