collapse data and transform packages into proxy

This commit is contained in:
Will Norris 2013-12-26 12:33:22 -08:00
parent d8aa853b3d
commit fc8552e6b4
4 changed files with 19 additions and 26 deletions

View file

@ -18,17 +18,13 @@ import (
"net/http"
"reflect"
"testing"
"github.com/willnorris/imageproxy/data"
)
var emptyOptions = new(data.Options)
func TestNewRequest(t *testing.T) {
tests := []struct {
URL string
RemoteURL string
Options *data.Options
Options *Options
ExpectError bool
}{
// invalid URLs
@ -52,7 +48,7 @@ func TestNewRequest(t *testing.T) {
},
{
"http://localhost/1xs/http://example.com/",
"http://example.com/", &data.Options{Width: 1}, false,
"http://example.com/", &Options{Width: 1}, false,
},
// valid URLs
@ -84,27 +80,27 @@ func TestNewRequest(t *testing.T) {
},
{
"http://localhost/1x/http://example.com/",
"http://example.com/", &data.Options{1, 0, false, 0, false, false}, false,
"http://example.com/", &Options{1, 0, false, 0, false, false}, false,
},
{
"http://localhost/x1/http://example.com/",
"http://example.com/", &data.Options{0, 1, false, 0, false, false}, false,
"http://example.com/", &Options{0, 1, false, 0, false, false}, false,
},
{
"http://localhost/1x2/http://example.com/",
"http://example.com/", &data.Options{1, 2, false, 0, false, false}, false,
"http://example.com/", &Options{1, 2, false, 0, false, false}, false,
},
{
"http://localhost/0.1x0.2/http://example.com/",
"http://example.com/", &data.Options{0.1, 0.2, false, 0, false, false}, false,
"http://example.com/", &Options{0.1, 0.2, false, 0, false, false}, false,
},
{
"http://localhost/,fit/http://example.com/",
"http://example.com/", &data.Options{0, 0, true, 0, false, false}, false,
"http://example.com/", &Options{0, 0, true, 0, false, false}, false,
},
{
"http://localhost/1x2,fit,r=90,fv,fh/http://example.com/",
"http://example.com/", &data.Options{1, 2, true, 90, true, true}, false,
"http://localhost/1x2,fit,r90,fv,fh/http://example.com/",
"http://example.com/", &Options{1, 2, true, 90, true, true}, false,
},
}