This repository has been archived by the owner on Oct 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathbid_response_test.go
67 lines (57 loc) · 1.68 KB
/
bid_response_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package openrtb2_test
import (
"encoding/json"
"io/ioutil"
"path/filepath"
. "github.com/mxmCherry/openrtb/v17/openrtb2"
. "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))
},
// 2.5
Entry(
"2.5 Ad Served on Win Notice",
"bid-response/2.5/ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.5 VAST XML Document Returned Inline",
"bid-response/2.5/vast-xml-document-returned-inline.json",
new(BidResponse)),
Entry(
"2.5 Direct Deal Ad Served on Win Notice",
"bid-response/2.5/direct-deal-ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.5 Native Markup Returned Inline",
"bid-response/2.5/native-markup-returned-inline.json",
new(BidResponse)),
// 2.6
Entry(
"2.6 Ad Served on Win Notice",
"bid-response/2.6/ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.6 VAST XML Document Returned Inline",
"bid-response/2.6/vast-xml-document-returned-inline.json",
new(BidResponse)),
Entry(
"2.6 Direct Deal Ad Served on Win Notice",
"bid-response/2.6/direct-deal-ad-served-on-win-notice.json",
new(BidResponse)),
Entry(
"2.6 Native Markup Returned Inline",
"bid-response/2.6/native-markup-returned-inline.json",
new(BidResponse)),
)
})