customer/tests/integration/history_report_test.go

37 lines
898 B
Go
Raw Normal View History

2023-11-02 12:27:58 +00:00
package integration_test
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
2024-11-18 07:23:41 +00:00
"gitea.pena/PenaSide/customer/internal/models"
"gitea.pena/PenaSide/customer/pkg/client"
"gitea.pena/PenaSide/customer/tests/helpers"
2023-11-02 12:27:58 +00:00
)
func TestHistoryReport(t *testing.T) {
ctx := context.Background()
jwtUtil := helpers.InitializeJWT()
token, err := jwtUtil.Create("807f1f77bcf81cd799439077")
2023-12-01 17:49:50 +00:00
2023-11-02 12:27:58 +00:00
if ok := assert.NoError(t, err); !ok {
return
}
response, err := client.Post[struct{}, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
2024-03-11 18:19:39 +00:00
URL: "http://" + "localhost:8082" + "/sendReport",
2024-05-20 12:32:59 +00:00
Body: struct{ Id string }{Id: "10002"},
2023-11-02 12:27:58 +00:00
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)
}