Skip to content

Commit

Permalink
Merge pull request #27 from SyntaxNode/remove_vendor_check
Browse files Browse the repository at this point in the history
  • Loading branch information
bsardo authored Mar 4, 2021
2 parents 1ec0458 + 1791805 commit ee98dab
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: go
go:
- "1.14"
- "1.12"
- "1.13"
- "1.14"
- "1.15"
- "1.16"

script:
- go test -timeout 30s github.com/prebid/go-gdpr/bitutils
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/prebid/go-gdpr

go 1.13

require github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456
require (
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456
github.com/stretchr/testify v1.7.0
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456 h1:SnUWpAH4lEUoS86woR12h21VMUbDe+DYp88V646wwMI=
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3 changes: 0 additions & 3 deletions vendorlist2/eager-parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ func ParseEagerly(data []byte) (api.VendorList, error) {
if contract.Version == 0 {
return nil, errors.New("data.vendorListVersion was 0 or undefined. Versions should start at 1")
}
if len(contract.Vendors) == 0 {
return nil, errors.New("data.vendors was undefined or had no elements")
}

parsedList := parsedVendorList{
version: contract.Version,
Expand Down
18 changes: 18 additions & 0 deletions vendorlist2/eager-parsing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/prebid/go-gdpr/api"
"github.com/stretchr/testify/assert"
)

func TestEagerlyParsedVendorList(t *testing.T) {
Expand All @@ -15,3 +16,20 @@ func TestEagerlyParsedVendorList(t *testing.T) {
return vendorList
})
}

func TestParseEagerlyVendorsEmpty(t *testing.T) {
vendorListJSON := `
{
"gvlSpecificationVersion": 2,
"vendorListVersion": 28,
"tcfPolicyVersion": 2,
"lastUpdated": "2020-03-05T16:05:29Z",
"vendors": { }
}
`
vendorList, err := ParseEagerly([]byte(vendorListJSON))

assert.NoError(t, err)
assert.Equal(t, vendorList.Version(), uint16(28))
assert.Nil(t, vendorList.Vendor(0))
}

0 comments on commit ee98dab

Please sign in to comment.