2015-03-19 19:30:55 +00:00
|
|
|
package lfs
|
2013-11-05 17:13:28 +00:00
|
|
|
|
|
|
|
import (
|
2015-03-20 02:47:35 +00:00
|
|
|
"encoding/base64"
|
|
|
|
"fmt"
|
2015-02-11 20:45:48 +00:00
|
|
|
"io/ioutil"
|
2015-03-20 02:47:35 +00:00
|
|
|
"net/http/httptest"
|
|
|
|
"net/url"
|
2013-11-05 17:13:28 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2015-02-11 22:16:01 +00:00
|
|
|
func tempdir(t *testing.T) string {
|
2015-03-19 19:30:55 +00:00
|
|
|
dir, err := ioutil.TempDir("", "git-lfs-test")
|
2015-02-11 22:16:01 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error getting temp dir: %s", err)
|
|
|
|
}
|
|
|
|
return dir
|
|
|
|
}
|
2015-03-20 02:47:35 +00:00
|
|
|
|
|
|
|
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 " + base64.URLEncoding.EncodeToString([]byte(token))
|
|
|
|
}
|