customer/tests/integration/history_report_test.go
Pasha 34a88a3a70
Some checks failed
Lint / Lint (push) Failing after 1m2s
rename go.mod
2024-11-18 21:44:09 +00:00

37 lines
898 B
Go

package integration_test
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"gitea.pena/PenaSide/customer/internal/models"
"gitea.pena/PenaSide/customer/pkg/client"
"gitea.pena/PenaSide/customer/tests/helpers"
)
func TestHistoryReport(t *testing.T) {
ctx := context.Background()
jwtUtil := helpers.InitializeJWT()
token, err := jwtUtil.Create("807f1f77bcf81cd799439077")
if ok := assert.NoError(t, err); !ok {
return
}
response, err := client.Post[struct{}, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
URL: "http://" + "localhost:8082" + "/sendReport",
Body: struct{ Id string }{Id: "10002"},
Headers: map[string]string{"Authorization": fmt.Sprintf("Bearer %s", token)},
})
if ok := assert.NoError(t, err); !ok {
return
}
if ok := assert.Nil(t, response.Error); !ok {
return
}
assert.Equal(t, 200, response.StatusCode)
}