generated from PenaSide/GolangTemplate
add failing test for /sendReport
This commit is contained in:
parent
2e4dbc7cc0
commit
5cefe5805b
@ -2,6 +2,7 @@ package swagger
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
@ -152,6 +153,10 @@ func (receiver *API) GetRecentTariffs(ctx echo.Context) error {
|
|||||||
return receiver.historyController.GetRecentTariffs(ctx)
|
return receiver.historyController.GetRecentTariffs(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (receiver *API) SendReport(ctx echo.Context) error {
|
||||||
|
return ctx.JSON(http.StatusInternalServerError, Error{Message: "work in progress"})
|
||||||
|
}
|
||||||
|
|
||||||
// Wallet
|
// Wallet
|
||||||
|
|
||||||
func (receiver *API) RequestMoney(ctx echo.Context) error {
|
func (receiver *API) RequestMoney(ctx echo.Context) error {
|
||||||
|
|||||||
37
tests/integration/history_report_test.go
Normal file
37
tests/integration/history_report_test.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package integration_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/swagger"
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestHistoryReport(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
jwtUtil := helpers.InitializeJWT()
|
||||||
|
token, err := jwtUtil.Create("807f1f77bcf81cd799439077")
|
||||||
|
// t.Log("TOKEN:", token)
|
||||||
|
if ok := assert.NoError(t, err); !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := client.Post[struct{}, models.ResponseErrorHTTP](ctx, &client.RequestSettings{
|
||||||
|
URL: "http://" + customerServiceBase + "/sendReport",
|
||||||
|
Body: swagger.SendReportJSONBody{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)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user