forked from mxmCherry/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenrtb_test.go
78 lines (67 loc) · 1.91 KB
/
openrtb_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
68
69
70
71
72
73
74
75
76
77
78
package openrtb_test
import (
"encoding/json"
"io/ioutil"
"path/filepath"
"testing"
"github.com/mxmCherry/openrtb"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
func TestOpenRTB(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "OpenRTB")
}
// ----------------------------------------------------------------------------
var _ = DescribeTable(
"Marshalling",
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(
"Bid Request - Simple Banner",
"bid-request-simple-banner.json",
new(openrtb.BidRequest)),
Entry(
"Bid Request - Expandable Creative",
"bid-request-expandable-creative.json",
new(openrtb.BidRequest)),
Entry(
"Bid Request - Mobile",
"bid-request-mobile.json",
new(openrtb.BidRequest)),
Entry(
"Bid Request - Video",
"bid-request-video.json",
new(openrtb.BidRequest)),
Entry(
"Bid Request - PMP with Direct Deal",
"bid-request-pmp-with-direct-deal.json",
new(openrtb.BidRequest)),
Entry(
"Bid Request - Native Ad",
"bid-request-native-ad.json",
new(openrtb.BidRequest)),
Entry(
"Bid Response - Ad Served on Win Notice",
"bid-response-ad-served-on-win-notice.json",
new(openrtb.BidResponse)),
Entry(
"Bid Response - VAST XML Document Returned Inline",
"bid-response-vast-xml-document-returned-inline.json",
new(openrtb.BidResponse)),
Entry(
"Bid Response - Direct Deal Ad Served on Win Notice",
"bid-response-direct-deal-ad-served-on-win-notice.json",
new(openrtb.BidResponse)),
Entry(
"Bid Response - Native Markup Returned Inline",
"bid-response-native-markup-returned-inline.json",
new(openrtb.BidResponse)),
)