go-openrtb/openrtb2/bid_response_test.go

49 строки
1.1 KiB
Go
Исходник Постоянная ссылка Обычный вид История

package openrtb2_test
2017-11-13 21:37:40 +03:00
import (
"encoding/json"
"io/ioutil"
"path/filepath"
. "github.com/mxmCherry/openrtb/openrtb2"
2017-11-13 21:37:40 +03:00
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("BidResponse", func() {
DescribeTable(
"Marshaling",
func(filename string, subject interface{}) {
expected, err := ioutil.ReadFile(filepath.Join("testdata", filename))
Expect(err).NotTo(HaveOccurred())
Expect(json.Unmarshal(expected, subject)).To(Succeed())
actual, err := json.Marshal(subject)
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(MatchJSON(expected))
},
Entry(
"Ad Served on Win Notice",
2017-11-13 21:59:35 +03:00
"bid-response/ad-served-on-win-notice.json",
2017-11-13 21:37:40 +03:00
new(BidResponse)),
Entry(
"VAST XML Document Returned Inline",
2017-11-13 21:59:35 +03:00
"bid-response/vast-xml-document-returned-inline.json",
2017-11-13 21:37:40 +03:00
new(BidResponse)),
Entry(
"Direct Deal Ad Served on Win Notice",
2017-11-13 21:59:35 +03:00
"bid-response/direct-deal-ad-served-on-win-notice.json",
2017-11-13 21:37:40 +03:00
new(BidResponse)),
Entry(
"Native Markup Returned Inline",
2017-11-13 21:59:35 +03:00
"bid-response/native-markup-returned-inline.json",
2017-11-13 21:37:40 +03:00
new(BidResponse)),
)
})