Exemple #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)
}
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)
}
Exemple #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)
}
Exemple #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)
}
func TestNonLinearAdsValidateErrors(t *testing.T) {
	for _, test := range nonLinearAdsTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}
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)
}
func TestLinearWrapperValidateErrors(t *testing.T) {
	for _, test := range linearWrapperTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}
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)
}
Exemple #10
0
func TestAdValidateErrors(t *testing.T) {
	for _, test := range adTests {
		vasttest.VerifyVastElementFromFile(t, "testdata/"+test.File, test.VastElement, test.Err)
	}
}