2019-08-03 03:41:09 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-10-25 00:27:02 +02:00
|
|
|
"github.com/kataras/iris/v12/httptest"
|
2019-08-03 03:41:09 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestReadYAML(t *testing.T) {
|
|
|
|
app := newApp()
|
|
|
|
e := httptest.New(t, app)
|
|
|
|
|
|
|
|
expectedResponse := `Received: main.product{Invoice:34843, Tax:251.42, Total:4443.52, Comments:"Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."}`
|
|
|
|
send := `invoice: 34843
|
|
|
|
tax : 251.42
|
|
|
|
total: 4443.52
|
|
|
|
comments: >
|
|
|
|
Late afternoon is best.
|
|
|
|
Backup contact is Nancy
|
|
|
|
Billsmer @ 338-4338.`
|
|
|
|
|
|
|
|
e.POST("/").WithHeader("Content-Type", "application/x-yaml").WithBytes([]byte(send)).Expect().
|
2023-07-08 01:08:18 +02:00
|
|
|
Status(httptest.StatusOK).Body().IsEqual(expectedResponse)
|
2019-08-03 03:41:09 +02:00
|
|
|
}
|