forked from mxmCherry/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
request_test.go
53 lines (43 loc) · 1.06 KB
/
request_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
package request_test
import (
"encoding/json"
"io/ioutil"
"path/filepath"
. "github.com/mxmCherry/openrtb/native/request"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Request", 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(
"Social Context (v1.1)",
"v1.1/social-context.json",
new(Request)),
Entry(
"Content Context (v1.1)",
"v1.1/content-context.json",
new(Request)),
Entry(
"Social Context (v1.2)",
"v1.2/social-context.json",
new(Request)),
Entry(
"Content Context (v1.2)",
"v1.2/content-context.json",
new(Request)),
Entry(
"Third-party (v1.2)",
"v1.2/third-party.json",
new(Request)),
)
})