forked from bsm/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bid_test.go
38 lines (32 loc) · 986 Bytes
/
bid_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
package openrtb
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bid", func() {
var subject *Bid
BeforeEach(func() {
Expect(fixture("bid", &subject)).To(Succeed())
})
It("should parse correctly", func() {
Expect(subject).To(Equal(&Bid{
ID: "1",
ImpID: "1",
Price: 0.751371,
AdID: "52a5516d29e435137c6f6e74",
NoticeURL: "http://ads.com/win/112770_1386565997?won=${AUCTION_PRICE}",
AdMarkup: "<html/>",
AdvDomains: []string{"ads.com"},
ImageURL: "http://ads.com/112770_1386565997.jpeg",
CampaignID: "52a5516d29e435137c6f6e74",
CreativeID: "52a5516d29e435137c6f6e74_1386565997",
DealID: "example_deal",
Attrs: []CreativeAttribute{},
}))
})
It("should validate", func() {
Expect((&Bid{}).Validate()).To(Equal(ErrInvalidBidNoID))
Expect((&Bid{ID: "BIDID"}).Validate()).To(Equal(ErrInvalidBidNoImpID))
Expect(subject.Validate()).NotTo(HaveOccurred())
})
})