优化结构
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
func TestWritePaymentCallbackAckDoesNotExposeError(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
recorder := httptest.NewRecorder()
|
||||
context, _ := gin.CreateTestContext(recorder)
|
||||
writePaymentCallbackAck(context, dto.PaymentCallbackAck{
|
||||
StatusCode: 500,
|
||||
ContentType: "text/plain; charset=utf-8",
|
||||
Body: []byte("failure"),
|
||||
})
|
||||
if recorder.Code != 500 {
|
||||
t.Fatalf("status = %d, want 500", recorder.Code)
|
||||
}
|
||||
if recorder.Body.String() != "failure" {
|
||||
t.Fatalf("body = %q, want fixed failure ack", recorder.Body.String())
|
||||
}
|
||||
if recorder.Body.String() == "internal order resolver details" {
|
||||
t.Fatal("internal error was exposed in callback response")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user