feat(files/sharing): refactor sharing apis with tests

This commit is contained in:
hexxa 2021-08-18 11:12:24 +08:00 committed by Hexxa
parent 5ef94afd7a
commit 80d54f42a1
5 changed files with 67 additions and 16 deletions

View file

@ -387,6 +387,22 @@ func TestFileHandlers(t *testing.T) {
}
}
for dirPath := range sharedPaths {
res, _, errs := cl.IsSharing(dirPath)
if len(errs) > 0 {
t.Fatal(errs)
} else if res.StatusCode != 200 {
t.Fatal(res.StatusCode)
}
res, _, errs = cl.IsSharing(fmt.Sprintf("%s/", dirPath))
if len(errs) > 0 {
t.Fatal(errs)
} else if res.StatusCode != 404 {
t.Fatal(res.StatusCode)
}
}
for _, dirPath := range shRes.SharingDirs {
res, lsResp, errs := cl.List(dirPath)
if len(errs) > 0 {