Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-02-03 09:06:02 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-02-15 02:17:24 +0300
commit586317c827f5878444bcc86bf953b21e7e31ee10 (patch)
treeb24d2dbd5ccb4c72acb670f5464ec190c83c12c1 /internal/testhelpers
parent24cc61d186feaefec3cc08225c58b07d3767dbbb (diff)
Add extra tests for serving zip archives from disk
Diffstat (limited to 'internal/testhelpers')
-rw-r--r--internal/testhelpers/testhelpers.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go
index 422a3d9a..f731166b 100644
--- a/internal/testhelpers/testhelpers.go
+++ b/internal/testhelpers/testhelpers.go
@@ -1,10 +1,12 @@
package testhelpers
import (
+ "fmt"
"mime"
"net/http"
"net/http/httptest"
"net/url"
+ "os"
"testing"
"github.com/sirupsen/logrus"
@@ -55,3 +57,14 @@ func AssertLogContains(t *testing.T, wantLogEntry string, entries []*logrus.Entr
require.Contains(t, messages, wantLogEntry)
}
}
+
+// ToFileProtocol appends the file:// protocol to the current os.Getwd
+// and formats path to be a full filepath
+func ToFileProtocol(t *testing.T, path string) string {
+ t.Helper()
+
+ wd, err := os.Getwd()
+ require.NoError(t, err)
+
+ return fmt.Sprintf("file://%s/%s", wd, path)
+}