mirror of
https://github.com/datarhei/core.git
synced 2025-10-08 17:30:52 +08:00
Add /api/v3/iam/user endpoints
This commit is contained in:
@@ -24,3 +24,31 @@ func TestToken(t *testing.T) {
|
||||
require.Equal(t, d[2], token, "url=%s", u.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitPath(t *testing.T) {
|
||||
data := map[string][]string{
|
||||
"/foo/bar": {"foo", "bar"},
|
||||
"foo/bar": {"foo", "bar"},
|
||||
"/foo/bar/": {"foo", "bar"},
|
||||
}
|
||||
|
||||
for path, split := range data {
|
||||
elms := splitPath(path)
|
||||
|
||||
require.ElementsMatch(t, split, elms, "%s", path)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemovePathPrefix(t *testing.T) {
|
||||
data := [][]string{
|
||||
{"/foo/bar", "/foo", "/bar"},
|
||||
{"/foo/bar", "/fo", "/foo/bar"},
|
||||
{"/foo/bar/abc", "/foo/bar", "/abc"},
|
||||
}
|
||||
|
||||
for _, d := range data {
|
||||
x, _ := removePathPrefix(d[0], d[1])
|
||||
|
||||
require.Equal(t, d[2], x, "path=%s prefix=%s", d[0], d[1])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user