1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-03-17 20:17:48 +02:00

Fix tests

This commit is contained in:
DarthSim 2018-11-20 19:03:24 +06:00
parent 6997e585ef
commit adf6055e6b

View File

@ -57,7 +57,8 @@ func (s *ProcessingOptionsTestSuite) TestParseBase64URLInvalid() {
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/%s.png", base64.RawURLEncoding.EncodeToString([]byte(imageURL))))
_, err := parsePath(context.Background(), req)
assert.Equal(s.T(), errInvalidImageURL, err)
require.Error(s.T(), err)
assert.Equal(s.T(), errInvalidImageURL.Error(), err.Error())
}
func (s *ProcessingOptionsTestSuite) TestParsePlainURL() {
@ -119,7 +120,8 @@ func (s *ProcessingOptionsTestSuite) TestParsePlainURLInvalid() {
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/plain/%s@png", imageURL))
_, err := parsePath(context.Background(), req)
assert.Equal(s.T(), errInvalidImageURL, err)
require.Error(s.T(), err)
assert.Equal(s.T(), errInvalidImageURL.Error(), err.Error())
}
func (s *ProcessingOptionsTestSuite) TestParsePlainURLEscapedInvalid() {
@ -127,7 +129,8 @@ func (s *ProcessingOptionsTestSuite) TestParsePlainURLEscapedInvalid() {
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/plain/%s@png", url.PathEscape(imageURL)))
_, err := parsePath(context.Background(), req)
assert.Equal(s.T(), errInvalidImageURL, err)
require.Error(s.T(), err)
assert.Equal(s.T(), errInvalidImageURL.Error(), err.Error())
}
func (s *ProcessingOptionsTestSuite) TestParsePathBasic() {
@ -551,7 +554,8 @@ func (s *ProcessingOptionsTestSuite) TestParsePathSignedInvalid() {
req := s.getRequest("http://example.com/unsafe/width:150/plain/http://images.dev/lorem/ipsum.jpg@png")
_, err := parsePath(context.Background(), req)
require.Equal(s.T(), errInvalidToken, err)
require.Error(s.T(), err)
assert.Equal(s.T(), errInvalidToken.Error(), err.Error())
}
func TestProcessingOptions(t *testing.T) {