Skip to content

Commit 7d47aca

Browse files
committed
Fixed tests, added travis config
1 parent 2dbd723 commit 7d47aca

File tree

4 files changed

+295
-282
lines changed

4 files changed

+295
-282
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: go
2+
install: make test
3+
go:
4+
- 1.2
5+
- 1.3
6+
- 1.4
7+

fixtures_test.go

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package openrtb
2+
3+
var testFixtures = struct {
4+
simpleBanner []byte
5+
expandableCreative []byte
6+
}{
7+
simpleBanner: []byte(`
8+
{
9+
"id":"1234534625254",
10+
"at":2,
11+
"tmax":120,
12+
"imp":[
13+
{
14+
"id":"1",
15+
"banner":{
16+
"w":300,
17+
"h":250,
18+
"pos":1,
19+
"battr":[13]
20+
}
21+
}
22+
],
23+
"badv":["company1.com","company2.com"],
24+
"site":{
25+
"id":"234563",
26+
"name":"Site ABCD",
27+
"domain":"siteabcd.com",
28+
"cat":["IAB2-1", "IAB2-2"],
29+
"privacypolicy":1,
30+
"page":"http://siteabcd.com/page.htm",
31+
"ref":"http://referringsite.com/referringpage.htm",
32+
"publisher":{
33+
"id":"pub12345",
34+
"name":"Publisher A"
35+
},
36+
"content":{
37+
"keywords":["keyword a","keyword b","keyword c"]
38+
}
39+
},
40+
"device":{
41+
"ip":"64.124.253.1",
42+
"ua":"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16",
43+
"os":"OS X",
44+
"flashver":"10.1",
45+
"js":1
46+
},
47+
"user":{
48+
"id":"45asdf987656789adfad4678rew656789",
49+
"buyeruid":"5df678asd8987656asdf78987654"
50+
}
51+
}
52+
`),
53+
expandableCreative: []byte(`
54+
{
55+
"id":"1234567893",
56+
"at":2,
57+
"tmax":120,
58+
"imp":[
59+
{
60+
"id":"1",
61+
"iframebuster":[
62+
"vendor1.com",
63+
"vendor2.com"
64+
],
65+
"banner":{
66+
"w":300,
67+
"h":250,
68+
"pos":1,
69+
"battr":[
70+
13
71+
],
72+
"expdir":[
73+
2,
74+
4
75+
]
76+
}
77+
}
78+
],
79+
"site":{
80+
"id":"1345135123",
81+
"name":"Site ABCD",
82+
"domain":"siteabcd.com",
83+
"sitecat":[
84+
"IAB2-1",
85+
"IAB2-2"
86+
],
87+
"page":"http://siteabcd.com/page.htm",
88+
"ref":"http://referringsite.com/referringpage.htm",
89+
"privacypolicy":1,
90+
"publisher":{
91+
"id":"pub12345",
92+
"name":"Publisher A"
93+
},
94+
"content":{
95+
"keyword":[
96+
"keyword1",
97+
"keyword2",
98+
"keyword3"
99+
]
100+
}
101+
},
102+
"device":{
103+
"ip":"64.124.253.1",
104+
"ua":"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16",
105+
"os":"OS X",
106+
"flashver":"10.1",
107+
"js":1
108+
},
109+
"user":{
110+
"id":"456789876567897654678987656789",
111+
"buyeruid":"545678765467876567898765678987654",
112+
"data":[
113+
{
114+
"id":"6",
115+
"name":"Data Provider 1",
116+
"segment":[
117+
{
118+
"id":"12341318394918",
119+
"name":"auto intenders"
120+
},
121+
{
122+
"id":"1234131839491234",
123+
"name":"auto enthusiasts"
124+
},
125+
{
126+
"id":"23423424",
127+
"name":"data-provider1-age",
128+
"value":"30-40"
129+
}
130+
]
131+
}
132+
]
133+
}
134+
}`),
135+
}

openrtb_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ import (
1313

1414
func TestSuite(t *testing.T) {
1515
RegisterFailHandler(Fail)
16-
RunSpecs(t, "github.com/bsm/openrtb")
16+
RunSpecs(t, "openrtb")
1717
}

0 commit comments

Comments
 (0)