git-lfs/lfs/client_test.go
2016-02-09 11:28:41 -07:00

30 lines
556 B
Go

package lfs
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http/httptest"
"net/url"
"strings"
"testing"
)
func tempdir(t *testing.T) string {
dir, err := ioutil.TempDir("", "git-lfs-test")
if err != nil {
t.Fatalf("Error getting temp dir: %s", err)
}
return dir
}
func expectedAuth(t *testing.T, server *httptest.Server) string {
u, err := url.Parse(server.URL)
if err != nil {
t.Fatal(err)
}
token := fmt.Sprintf("%s:%s", u.Host, "monkey")
return "Basic " + strings.TrimSpace(base64.StdEncoding.EncodeToString([]byte(token)))
}