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 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)
}