From 75ac9ee246e7d3be5890b972a241855da875f4b0 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 16 Feb 2023 15:44:08 +0100 Subject: HTTP: Incorporate util ensure valid url with clean path --- internal/util/util_test.go | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'internal/util/util_test.go') diff --git a/internal/util/util_test.go b/internal/util/util_test.go index cb82123..c3d1cee 100644 --- a/internal/util/util_test.go +++ b/internal/util/util_test.go @@ -5,39 +5,6 @@ import ( "testing" ) -func TestEnsureValidURL(t *testing.T) { - _, validErr := EnsureValidURL("%notvalid%") - - if validErr == nil { - t.Fatal("Got nil error, want: non-nil") - } - - testCases := map[string]string{ - // Make sure we set https - "example.com/": "https://example.com/", - // Make sure we do override the scheme to https - "http://example.com/": "https://example.com/", - // This URL is already valid - "https://example.com/": "https://example.com/", - // Make sure to add a trailing slash (/) - "https://example.com": "https://example.com/", - // Cleanup the path 1 - "https://example.com/////": "https://example.com/", - // Cleanup the path 2 - "https://example.com/..": "https://example.com/", - } - - for k, v := range testCases { - valid, validErr := EnsureValidURL(k) - if validErr != nil { - t.Fatalf("Got: %v, want: nil", validErr) - } - if valid != v { - t.Fatalf("Got: %v, want: %v", valid, v) - } - } -} - func TestMakeRandomByteSlice(t *testing.T) { random, randomErr := MakeRandomByteSlice(32) if randomErr != nil { -- cgit v1.2.3