diff options
Diffstat (limited to 'template/functions_test.go')
-rw-r--r-- | template/functions_test.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/template/functions_test.go b/template/functions_test.go index a816eb7..ff563b2 100644 --- a/template/functions_test.go +++ b/template/functions_test.go @@ -134,13 +134,13 @@ func TestElapsedTime(t *testing.T) { func TestProxyFilterWithHttpDefault(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "http-only") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="http://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="/proxy/aHR0cDovL3dlYnNpdGUvZm9sZGVyL2ltYWdlLnBuZw==" alt="Test"/></p>` if expected != output { @@ -151,13 +151,13 @@ func TestProxyFilterWithHttpDefault(t *testing.T) { func TestProxyFilterWithHttpsDefault(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "http-only") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` if expected != output { @@ -168,13 +168,13 @@ func TestProxyFilterWithHttpsDefault(t *testing.T) { func TestProxyFilterWithHttpNever(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "none") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="http://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := input if expected != output { @@ -185,13 +185,13 @@ func TestProxyFilterWithHttpNever(t *testing.T) { func TestProxyFilterWithHttpsNever(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "none") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := input if expected != output { @@ -202,13 +202,13 @@ func TestProxyFilterWithHttpsNever(t *testing.T) { func TestProxyFilterWithHttpAlways(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "all") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="http://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="/proxy/aHR0cDovL3dlYnNpdGUvZm9sZGVyL2ltYWdlLnBuZw==" alt="Test"/></p>` if expected != output { @@ -219,13 +219,13 @@ func TestProxyFilterWithHttpAlways(t *testing.T) { func TestProxyFilterWithHttpsAlways(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "all") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="/proxy/aHR0cHM6Ly93ZWJzaXRlL2ZvbGRlci9pbWFnZS5wbmc=" alt="Test"/></p>` if expected != output { @@ -236,13 +236,13 @@ func TestProxyFilterWithHttpsAlways(t *testing.T) { func TestProxyFilterWithHttpInvalid(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "invalid") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="http://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="/proxy/aHR0cDovL3dlYnNpdGUvZm9sZGVyL2ltYWdlLnBuZw==" alt="Test"/></p>` if expected != output { @@ -253,13 +253,13 @@ func TestProxyFilterWithHttpInvalid(t *testing.T) { func TestProxyFilterWithHttpsInvalid(t *testing.T) { os.Clearenv() os.Setenv("PROXY_IMAGES", "invalid") - c := config.NewConfig() + config.ParseConfig() r := mux.NewRouter() r.HandleFunc("/proxy/{encodedURL}", func(w http.ResponseWriter, r *http.Request) {}).Name("proxy") input := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` - output := imageProxyFilter(r, c, input) + output := imageProxyFilter(r, input) expected := `<p><img src="https://website/folder/image.png" alt="Test"/></p>` if expected != output { |