generated from PenaSide/GolangTemplate
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
|
package e2e_test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
|
||
|
"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"
|
||
|
)
|
||
|
|
||
|
// todo thinking
|
||
|
func TestSendReport(t *testing.T) {
|
||
|
jwtUtil := helpers.InitializeJWT()
|
||
|
|
||
|
t.Run("Send Report", func(t *testing.T) {
|
||
|
ctx, cancel := context.WithCancel(context.Background())
|
||
|
defer cancel()
|
||
|
|
||
|
historyID := "641b2d73e0e07a7e90b59616"
|
||
|
|
||
|
token, tokenErr := jwtUtil.Create("64e5d9830fcca0596d82c0c1")
|
||
|
assert.NoError(t, tokenErr)
|
||
|
|
||
|
responseSendReport, errSendReport := client.Post[interface{}, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
|
||
|
URL: "http://localhost:8000/sendReport",
|
||
|
Headers: map[string]string{"Authorization": fmt.Sprintf("Bearer %s", token)},
|
||
|
Body: map[string]interface{}{"id": historyID},
|
||
|
})
|
||
|
assert.NoError(t, errSendReport)
|
||
|
assert.Nil(t, responseSendReport.Error)
|
||
|
|
||
|
assert.Equal(t, http.StatusOK, responseSendReport.StatusCode)
|
||
|
})
|
||
|
}
|