Remove Staticcheck warnings (#5394)
* remove deprecated ioutil imports Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * remove duplicate imports Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * remove unused values Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * remove some unused types Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * remove deprecated ioutil import Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -370,7 +370,7 @@ func TestGetEducationSchoolUsers(t *testing.T) {
|
||||
lm := &mocks.Client{}
|
||||
lm.On("Search", schoolByIDSearch1).Return(&ldap.SearchResult{Entries: []*ldap.Entry{schoolEntry, schoolEntry1}}, nil)
|
||||
lm.On("Search", usersBySchoolIDSearch).Return(&ldap.SearchResult{Entries: []*ldap.Entry{eduUserEntryWithSchool}}, nil)
|
||||
b, err := getMockedBackend(lm, eduConfig, &logger)
|
||||
b, _ := getMockedBackend(lm, eduConfig, &logger)
|
||||
users, err := b.GetEducationSchoolUsers(context.Background(), "abcd-defg")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 1, len(users))
|
||||
|
||||
@@ -120,7 +120,7 @@ func TestGetEducationUser(t *testing.T) {
|
||||
assert.Equal(t, "Test User", user.GetDisplayName())
|
||||
assert.Equal(t, "abcd-defg", user.GetId())
|
||||
|
||||
user, err = b.GetEducationUser(context.Background(), "xxxx-xxxx", nil)
|
||||
_, err = b.GetEducationUser(context.Background(), "xxxx-xxxx", nil)
|
||||
lm.AssertNumberOfCalls(t, "Search", 2)
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, "itemNotFound", err.Error())
|
||||
|
||||
@@ -255,7 +255,7 @@ func TestGetUser(t *testing.T) {
|
||||
nil)
|
||||
|
||||
b, _ = getMockedBackend(lm, lconfig, &logger)
|
||||
u, err = b.GetUser(context.Background(), "invalid", nil)
|
||||
_, err = b.GetUser(context.Background(), "invalid", nil)
|
||||
if err == nil || err.Error() != "itemNotFound" {
|
||||
t.Errorf("Expected 'itemNotFound' got '%s'", err.Error())
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
@@ -301,7 +300,7 @@ var _ = Describe("EducationClass", func() {
|
||||
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))
|
||||
svc.PatchEducationClass(rr, r)
|
||||
|
||||
resp, err := ioutil.ReadAll(rr.Body)
|
||||
resp, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(resp)).To(ContainSubstring("Request is limited to 20"))
|
||||
@@ -332,7 +331,7 @@ var _ = Describe("EducationClass", func() {
|
||||
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))
|
||||
svc.PatchEducationClass(rr, r)
|
||||
|
||||
resp, err := ioutil.ReadAll(rr.Body)
|
||||
resp, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(resp)).To(ContainSubstring("Error parsing member@odata.bind values"))
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
userprovider "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
@@ -46,8 +45,8 @@ var _ = Describe("Graph", func() {
|
||||
cfg *config.Config
|
||||
rr *httptest.ResponseRecorder
|
||||
|
||||
currentUser = &userv1beta1.User{
|
||||
Id: &userv1beta1.UserId{
|
||||
currentUser = &userprovider.User{
|
||||
Id: &userprovider.UserId{
|
||||
OpaqueId: "user",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
@@ -298,7 +297,7 @@ var _ = Describe("Groups", func() {
|
||||
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))
|
||||
svc.PatchGroup(rr, r)
|
||||
|
||||
resp, err := ioutil.ReadAll(rr.Body)
|
||||
resp, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(resp)).To(ContainSubstring("Request is limited to 20"))
|
||||
@@ -329,7 +328,7 @@ var _ = Describe("Groups", func() {
|
||||
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))
|
||||
svc.PatchGroup(rr, r)
|
||||
|
||||
resp, err := ioutil.ReadAll(rr.Body)
|
||||
resp, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(resp)).To(ContainSubstring("Error parsing member@odata.bind values"))
|
||||
|
||||
@@ -25,13 +25,6 @@ import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
type changePwTest struct {
|
||||
desc string
|
||||
currentpw string
|
||||
newpw string
|
||||
expected int
|
||||
}
|
||||
|
||||
var _ = Describe("Users changing their own password", func() {
|
||||
var (
|
||||
svc service.Service
|
||||
|
||||
Reference in New Issue
Block a user