package e2e_test import ( "context" "fmt" "gitea.pena/PenaSide/customer/internal/models" "gitea.pena/PenaSide/customer/pkg/client" "gitea.pena/PenaSide/customer/tests/helpers" "testing" "github.com/stretchr/testify/assert" ) func TestAddAccount(t *testing.T) { jwtUtil := helpers.InitializeJWT() t.Run("Создать новый аккаунт", func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() assert.NotPanics(t, func() { token, tokenErr := jwtUtil.Create("64e5d9830fcca0596d82c0c1") if isNoError := assert.NoError(t, tokenErr); !isNoError { return } responseAddAccount, errAddAccount := client.Post[models.Account, models.ResponseErrorHTTP](ctx, &client.RequestSettings{ URL: "http://localhost:8082/account", Headers: map[string]string{"Authorization": fmt.Sprintf("Bearer %s", token)}, QueryParams: map[string]string{"id": "64e5d9830fcca0596d82c0c1"}, }) if isNoError := assert.NoError(t, errAddAccount); !isNoError { return } if isNoRequestError := assert.Nil(t, responseAddAccount.Error); !isNoRequestError { return } assert.Equal(t, "64e5d9830fcca0596d82c0c1", responseAddAccount.Body.UserID) }) }) }