mirror of
https://github.com/restic/rest-server.git
synced 2026-04-07 10:42:07 -07:00
added test for private repos
This commit is contained in:
@@ -71,3 +71,24 @@ func TestTLSSettings(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIsUserPath(t *testing.T) {
|
||||||
|
var tests = []struct {
|
||||||
|
username string
|
||||||
|
path string
|
||||||
|
result bool
|
||||||
|
}{
|
||||||
|
{"foo", "/", false},
|
||||||
|
{"foo", "/foo", true},
|
||||||
|
{"foo", "/foo/", true},
|
||||||
|
{"foo", "/foo/bar", true},
|
||||||
|
{"foo", "/foobar", false},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
result := isUserPath(test.username, test.path)
|
||||||
|
if result != test.result {
|
||||||
|
t.Errorf("isUserPath(%q, %q) was incorrect, got: %v, want: %v.", test.username, test.path, result, test.result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user