示例#1
0
func TestImpressionValidateError(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/impression.xml", &vast.Impression{}, nil)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Impression id="show-me-money"></Impression>`),
		&vast.Impression{}, vast.ErrImpressionMissUri)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Impression><![CDATA[http://impression/here]]></Impression>`),
		&vast.Impression{}, nil)
}
示例#2
0
func TestHtmlResourceValidateErrors(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/htmlresource.xml", &vast.HtmlResource{}, nil)
	vasttest.VerifyVastElementFromBytes(t,
		[]byte(`<HTMLResource><![CDATA[<html><body>Say Hi!</body></html>]]></HTMLResource>`),
		&vast.HtmlResource{}, nil)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<HTMLResource xmlEncoded="true"></HTMLResource>`),
		&vast.HtmlResource{}, vast.ErrHtmlResourceMissHtml)
}
示例#3
0
func TestPricingValidateErrors(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/pricing.xml", &vast.Pricing{}, nil)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Pricing model="cpm" currency="USD"></Pricing>`),
		&vast.Pricing{}, vast.ErrPricingMissPrice)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Pricing model="cpm">1.20</Pricing>`),
		&vast.Pricing{}, vast.ErrPricingCurrencyFormat)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Pricing currency="USD">1.20</Pricing>`),
		&vast.Pricing{}, vast.ErrPricingMissModel)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Pricing model="c" currency="USD">1.20</Pricing>`),
		&vast.Pricing{}, vast.ErrUnsupportedPriceModelType)
}
示例#4
0
func TestTrackingValidateErrors(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/tracking.xml", &vast.Tracking{}, nil)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<Tracking event="mute" offset="11:22:33"></Tracking>`), &vast.Tracking{}, vast.ErrTrackingMissUri)
}
示例#5
0
func TestNonLinearAdsValidateErrors(t *testing.T) {
	for _, test := range nonLinearAdsTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}
示例#6
0
func TestAdParametersValidateError(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/adparameters.xml", &vast.AdParameters{}, nil)
	vasttest.VerifyVastElementFromBytes(t, []byte(`<AdParameters xmlEncoded="true"></AdParameters>`),
		&vast.AdParameters{}, vast.ErrAdParametersMissParameters)
}
示例#7
0
func TestLinearWrapperValidateErrors(t *testing.T) {
	for _, test := range linearWrapperTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}
示例#8
0
func TestCompanionAdsValidateErrors(t *testing.T) {
	for _, test := range companionAdsTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}
func TestNonLinearWrapperValidateErrors(t *testing.T) {
	vasttest.VerifyVastElementFromFile(t, "testdata/nonlinearwrapper.xml", &vast.NonLinearWrapper{}, nil)
	vasttest.VerifyVastElementFromFile(t, "testdata/nonlinearwrapper_error_tracking.xml", &vast.NonLinearWrapper{}, vast.ErrTrackingMissUri)
}
示例#10
0
func TestAdValidateErrors(t *testing.T) {
	for _, test := range adTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}