mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
scaleup flag
This commit is contained in:
parent
f6e6a2cc86
commit
4e60c683b0
7 changed files with 57 additions and 15 deletions
|
|
@ -12,6 +12,8 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gregjones/httpcache"
|
||||
)
|
||||
|
||||
func TestAllowed(t *testing.T) {
|
||||
|
|
@ -187,6 +189,15 @@ func TestCheck304(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// make sure that the proxy is passed to transport in order
|
||||
// to access the command line flags.
|
||||
func TestProxyPointer(t *testing.T) {
|
||||
p := NewProxy(nil, nil)
|
||||
if p.Client.Transport.(*httpcache.Transport).Transport.(*TransformingTransport).Proxy != p {
|
||||
t.Errorf("Transport doesnt have proxy pointer")
|
||||
}
|
||||
}
|
||||
|
||||
// testTransport is an http.RoundTripper that returns certained canned
|
||||
// responses for particular requests.
|
||||
type testTransport struct{}
|
||||
|
|
@ -272,7 +283,10 @@ func TestProxy_ServeHTTP_is304(t *testing.T) {
|
|||
|
||||
func TestTransformingTransport(t *testing.T) {
|
||||
client := new(http.Client)
|
||||
tr := &TransformingTransport{testTransport{}, client}
|
||||
tr := &TransformingTransport{
|
||||
Transport: testTransport{},
|
||||
CachingClient: client,
|
||||
}
|
||||
client.Transport = tr
|
||||
|
||||
tests := []struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue