Пример #1
0
func TestGetUrlScenario3(t *testing.T) {
	//For spec 3: https://github.com/thumbor/thumbor/wiki/Libraries#scenario-3---thumbor-matching-of-signature-with-my-library-signature-with-meta
	thumborOptions := gothumbor.ThumborOptions{Meta: true}
	newURL, err := gothumbor.GetCryptedThumborPath(myKey, imageURL, thumborOptions)

	if err != nil {
		t.Errorf("Got an error when tried to generate the thumbor url:%s", err)
	}

	if newURL != metaEncryptedURL {
		t.Error("Got an unxpected thumbor path:", newURL)
	}
}
Пример #2
0
func TestGetUrlScenario6(t *testing.T) {
	//For spec 1: https://github.com/thumbor/thumbor/wiki/Libraries#scenario-6---thumbor-matching-of-signature-with-my-library-signature-with-filters

	thumborOptions := gothumbor.ThumborOptions{Filters: []string{"quality(20)", "brightness(10)"}}
	newURL, err := gothumbor.GetCryptedThumborPath(myKey, imageURL, thumborOptions)

	if err != nil {
		t.Errorf("Got an error when tried to generate the thumbor url:%s", err)
	}

	if newURL != filtersEncrytedURL {
		t.Error("Got an unxpected thumbor path:", newURL)
	}
}
Пример #3
0
func TestGetUrlScenario1(t *testing.T) {
	//For spec 1: https://github.com/thumbor/thumbor/wiki/Libraries#scenario-1---signing-of-a-known-url-results

	thumborOptions := gothumbor.ThumborOptions{Width: width, Height: height}
	newURL, err := gothumbor.GetCryptedThumborPath(myKey, imageURL, thumborOptions)

	if err != nil {
		t.Errorf("Got an error when tried to generate the thumbor url:%s", err)
	}

	if newURL != widthHeightEncryptedURL {
		t.Error("Got an unxpected thumbor path:", newURL)
	}
}