1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-09 00:00:02 +01:00

small changes

This commit is contained in:
Chapuis Bertil 2015-09-18 13:01:49 +02:00
parent 5db483883d
commit 847167241e

View file

@ -34,11 +34,12 @@ func TestRestBackend(t *testing.T) {
os.MkdirAll(filepath.Join(path, d), backend.Modes.Dir)
}
r := http.NewServeMux()
router := http.NewServeMux()
// Check if a configuration exists.
r.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) {
router.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) {
method := r.Method
file := filepath.Join(path, "config")
_, err := os.Stat(file)
@ -65,9 +66,11 @@ func TestRestBackend(t *testing.T) {
})
for _, dir := range dirs {
r.HandleFunc("/"+dir+"/", func(w http.ResponseWriter, r *http.Request) {
router.HandleFunc("/"+dir+"/", func(w http.ResponseWriter, r *http.Request) {
method := r.Method
vars := strings.Split(r.RequestURI, "/")
dir := vars[1]
name := vars[2]
path := filepath.Join(path, dir, name)
_, err := os.Stat(path)
@ -115,7 +118,7 @@ func TestRestBackend(t *testing.T) {
}
// Start the server and launch the tests.
s := httptest.NewServer(r)
s := httptest.NewServer(router)
defer s.Close()
u, _ := url.Parse(s.URL)