Fix tests

Co-authored-by: Julian Koberg <jkoberg@owncloud.com>
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2023-06-16 11:56:03 +02:00
parent 4aa9b2e416
commit 9198dd9a67
2 changed files with 8 additions and 2 deletions

View File

@@ -139,6 +139,12 @@ var _ = Describe("AppRoleAssignments", func() {
AccountUuid: user.GetId(),
RoleId: "some-appRole-ID",
}
roleService.On("ListRoleAssignments", mock.Anything, mock.Anything, mock.Anything).Return(&settings.ListRoleAssignmentsResponse{
Assignments: []*settingsmsg.UserRoleAssignment{
userRoleAssignment,
},
}, nil)
roleService.On("AssignRoleToUser", mock.Anything, mock.Anything, mock.Anything).Return(&settings.AssignRoleToUserResponse{Assignment: userRoleAssignment}, nil)
ara := libregraph.NewAppRoleAssignmentWithDefaults()

View File

@@ -809,7 +809,7 @@ var _ = Describe("Users", func() {
user.SetMail("user@example.com")
user.SetId("/users/user")
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(&user, nil)
identityBackend.On("GetUser", mock.Anything, mock.Anything, mock.Anything).Return(user, nil)
})
It("handles missing userids", func() {
@@ -866,7 +866,7 @@ var _ = Describe("Users", func() {
data, err := json.Marshal(user)
Expect(err).ToNot(HaveOccurred())
r := httptest.NewRequest(http.MethodPost, "/graph/v1.0/users?$invalid=true", bytes.NewBuffer(data))
r := httptest.NewRequest(http.MethodPost, "/graph/v1.0/users", bytes.NewBuffer(data))
rctx := chi.NewRouteContext()
rctx.URLParams.Add("userID", user.GetId())
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))