Native 1.2: copied/adapted awful 1.2 examples for tests

This commit is contained in:
Max Cherry
2018-02-28 09:36:46 +02:00
parent bd5e8ad685
commit abd794089f
16 changed files with 377 additions and 9 deletions
+17 -4
View File
@@ -29,12 +29,25 @@ var _ = Describe("Request", func() {
},
Entry(
"Social Context",
"social-context.json",
"Social Context (v1.1)",
"v1.1/social-context.json",
new(Request)),
Entry(
"Content Context",
"content-context.json",
"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)),
)
})
@@ -1,4 +1,4 @@
# testdata
# v1.1
JSON examples copied from [OpenRTB](https://www.iab.com/guidelines/real-time-bidding-rtb-project/) [Dynamic Native Ads API
Specification Version 1.1](https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-Native-Ads-Specification-1-1_2016.pdf) spec - section 6 Bid Request/Response Samples.
+10
View File
@@ -0,0 +1,10 @@
# v1.2
JSON examples copied from [OpenRTB](https://www.iab.com/guidelines/real-time-bidding-rtb-project/) [Dynamic Native Ads API
Specification Version 1.2](https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf) spec - section 6 Bid Request/Response Samples.
Some empty/zero attributes were omited (not copied) because of [encoding/json](https://golang.org/pkg/encoding/json/) `omitempty` and [gomega.MatchJSON(...)](http://onsi.github.io/gomega/#matchjsonjson-interface).
Some parts were adapted due too poor quality of examples in spec:
- `eventtrackers`: called `eventtrackers` in spec, but `eventrackers` in example
- `eventtrackers`: request example included response `eventrrackers`
+78
View File
@@ -0,0 +1,78 @@
{
"ver": "1.2",
"context": 1,
"contextsubtype": 10,
"plcmttype": 11,
"plcmtcnt": 1,
"privacy": 1,
"eventtrackers": [{
"event": 1,
"methods": [1, 2]
},
{
"event": 2,
"methods": [1]
}
],
"assets": [{
"id": 4,
"video": {
"minduration": 15,
"maxduration": 30,
"protocols": [
2, 3
],
"mimes": [
"video/mp4"
]
}
},
{
"id": 123,
"required": 1,
"title": {
"len": 140
}
},
{
"id": 128,
"img": {
"wmin": 836,
"hmin": 627,
"type": 3
}
},
{
"id": 124,
"required": 1,
"img": {
"wmin": 50,
"hmin": 50,
"type": 1
}
},
{
"id": 126,
"required": 1,
"data": {
"type": 1,
"len": 25
}
},
{
"id": 127,
"required": 1,
"data": {
"type": 2,
"len": 140
}
}
],
"eventtrackers": [{
"event": 1,
"methods": [2]
}, {
"event": 2,
"methods": [1]
}]
}
+58
View File
@@ -0,0 +1,58 @@
{
"ver": "1.2",
"context": 2,
"contextsubtype": 20,
"plcmttype": 11,
"plcmtcnt": 1,
"privacy": 1,
"eventtrackers": [{
"event": 1,
"methods": [1, 2]
},
{
"event": 2,
"methods": [1]
}
],
"assets": [{
"id": 123,
"required": 1,
"title": {
"len": 140
}
},
{
"id": 128,
"img": {
"wmin": 836,
"hmin": 627,
"type": 3
}
},
{
"id": 124,
"required": 1,
"img": {
"wmin": 50,
"hmin": 50,
"type": 1
}
},
{
"id": 126,
"required": 1,
"data": {
"type": 1,
"len": 25
}
},
{
"id": 127,
"required": 1,
"data": {
"type": 2,
"len": 140
}
}
]
}
+50
View File
@@ -0,0 +1,50 @@
{
"ver": "1.2",
"context": 2,
"contextsubtype": 20,
"plcmttype": 11,
"plcmtcnt": 1,
"aurlsupport": 1,
"durlsupport": 1,
"assets": [{
"id": 123,
"required": 1,
"title": {
"len": 140
}
},
{
"id": 128,
"img": {
"wmin": 836,
"hmin": 627,
"type": 3
}
},
{
"id": 124,
"required": 1,
"img": {
"wmin": 50,
"hmin": 50,
"type": 1
}
},
{
"id": 126,
"required": 1,
"data": {
"type": 1,
"len": 25
}
},
{
"id": 127,
"required": 1,
"data": {
"type": 2,
"len": 140
}
}
]
}
+17 -4
View File
@@ -29,12 +29,25 @@ var _ = Describe("Response", func() {
},
Entry(
"Clickout",
"clickout.json",
"Clickout (v1.1)",
"v1.1/clickout.json",
new(Response)),
Entry(
"Video",
"video.json",
"Video (v1.1)",
"v1.1/video.json",
new(Response)),
Entry(
"Clickout (v1.2)",
"v1.2/clickout.json",
new(Response)),
Entry(
"Video (v1.2)",
"v1.2/video.json",
new(Response)),
Entry(
"Third-party (v1.2)",
"v1.2/third-party.json",
new(Response)),
)
})
+6
View File
@@ -0,0 +1,6 @@
# v1.2
JSON examples copied from [OpenRTB](https://www.iab.com/guidelines/real-time-bidding-rtb-project/) [Dynamic Native Ads API
Specification Version 1.2](https://iabtechlab.com/wp-content/uploads/2016/07/OpenRTB-Native-Ads-Specification-Final-1.2.pdf) spec - section 6 Bid Request/Response Samples.
Some empty/zero attributes were omited (not copied) because of [encoding/json](https://golang.org/pkg/encoding/json/) `omitempty` and [gomega.MatchJSON(...)](http://onsi.github.io/gomega/#matchjsonjson-interface).
+51
View File
@@ -0,0 +1,51 @@
{
"link": {
"url": "http://i.am.a/URL"
},
"assets": [{
"id": 123,
"required": 1,
"title": {
"text": "Learn about this awesome thing"
}
},
{
"id": 124,
"required": 1,
"img": {
"url": "http://www.myads.com/thumbnail1.png"
}
},
{
"id": 128,
"required": 1,
"img": {
"url": "http://www.myads.com/largethumb1.png"
}
},
{
"id": 126,
"required": 1,
"data": {
"value": "My Brand"
}
},
{
"id": 127,
"required": 1,
"data": {
"value": "Learn all about this awesome story of someone using my product."
}
}
],
"eventtrackers": [{
"event": 1,
"method": 2,
"url": "http://www.mytracker.com/tracker.js"
}, {
"event": 2,
"method": 1,
"url": "http://www.mytracker.com/tracker.php"
}],
"privacy": "http://www.myprivacyurl.com"
}
+42
View File
@@ -0,0 +1,42 @@
{
"assetsurl": "http://www.myadserver.com/getad123nativejson.php",
"link": {
"url": "http: //i.am.a/URL"
},
"assets": [{
"id": 123,
"required": 1,
"title": {
"text": "Learn about this awesome thing"
}
},
{
"id": 124,
"required": 1,
"img": {
"url": "http://www.myads.com/thumbnail1.png"
}
},
{
"id": 128,
"required": 1,
"img": {
"url": "http://www.myads.com/largethumb1.png"
}
},
{
"id": 126,
"required": 1,
"data": {
"value": "My Brand"
}
},
{
"id": 127,
"required": 1,
"data": {
"value": "Learn all about this awesome story of someone using my product."
}
}
]
}
+47
View File
@@ -0,0 +1,47 @@
{
"link": {
"url": "http: //i.am.a/URL"
},
"assets": [{
"id": 4,
"video": {
"vasttag": "<VAST version='2.0'></VAST>"
}
},
{
"id": 123,
"required": 1,
"title": {
"text": "Watch this awesome thing"
}
},
{
"id": 124,
"required": 1,
"img": {
"url": "http://www.myads.com/thumbnail1.png"
}
},
{
"id": 128,
"required": 1,
"img": {
"url": "http://www.myads.com/largethumb1.png"
}
},
{
"id": 126,
"required": 1,
"data": {
"value": "My Brand"
}
},
{
"id": 127,
"required": 1,
"data": {
"value": "Watch all about this awesome story of someone using my product."
}
}
]
}