customer/tests/e2e/сurrencies_test.go

35 lines
986 B
Go
Raw Normal View History

2024-02-01 13:48:29 +00:00
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{
2024-03-11 18:19:39 +00:00
URL: "http://localhost:8082/currencies",
2024-02-01 13:48:29 +00:00
})
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)
})
})
}