[full-ci] Delete resharing tests (#8704)
* feat: disable resharing by default delete re-sharing tests * fix tests --------- Co-authored-by: Michael Barz <mbarz@owncloud.com>
This commit is contained in:
co-authored by
Michael Barz
parent
3143fd9c76
commit
79c74711c4
@@ -108,7 +108,7 @@ func DefaultConfig() *config.Config {
|
||||
EnableTLS: false,
|
||||
},
|
||||
FilesSharing: config.FilesSharing{
|
||||
EnableResharing: true,
|
||||
EnableResharing: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,36 +731,37 @@ var _ = Describe("Driveitems", func() {
|
||||
_, ok := res.GetExpirationDateTimeOk()
|
||||
Expect(ok).To(BeFalse())
|
||||
})
|
||||
It("updates the share permissions with changing the role", func() {
|
||||
getPublicShareMockResponse.Share = nil
|
||||
getPublicShareMockResponse.Status = status.NewNotFound(ctx, "not found")
|
||||
updateShareMock := gatewayClient.On("UpdateShare",
|
||||
mock.Anything,
|
||||
mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool {
|
||||
return req.GetShare().GetId().GetOpaqueId() == "permissionid"
|
||||
}),
|
||||
)
|
||||
updateShareMock.Return(updateShareMockResponse, nil)
|
||||
// that is resharing test. Please delete after disable resharing feature
|
||||
|
||||
// It("updates the share permissions with changing the role", func() {
|
||||
// getPublicShareMockResponse.Share = nil
|
||||
// getPublicShareMockResponse.Status = status.NewNotFound(ctx, "not found")
|
||||
// updateShareMock := gatewayClient.On("UpdateShare",
|
||||
// mock.Anything,
|
||||
// mock.MatchedBy(func(req *collaboration.UpdateShareRequest) bool {
|
||||
// return req.GetShare().GetId().GetOpaqueId() == "permissionid"
|
||||
// }),
|
||||
// )
|
||||
// updateShareMock.Return(updateShareMockResponse, nil)
|
||||
// driveItemPermission.SetRoles([]string{unifiedrole.NewViewerUnifiedRole(false).GetId()})
|
||||
// body, err := driveItemPermission.MarshalJSON()
|
||||
// Expect(err).To(BeNil())
|
||||
// svc.UpdatePermission(
|
||||
// rr,
|
||||
// httptest.NewRequest(http.MethodPatch, "/", strings.NewReader(string(body))).
|
||||
// WithContext(ctx),
|
||||
// )
|
||||
// Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
// data, err := io.ReadAll(rr.Body)
|
||||
// Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
driveItemPermission.SetRoles([]string{unifiedrole.NewViewerUnifiedRole(true).GetId()})
|
||||
body, err := driveItemPermission.MarshalJSON()
|
||||
Expect(err).To(BeNil())
|
||||
svc.UpdatePermission(
|
||||
rr,
|
||||
httptest.NewRequest(http.MethodPatch, "/", strings.NewReader(string(body))).
|
||||
WithContext(ctx),
|
||||
)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// res := libregraph.Permission{}
|
||||
|
||||
res := libregraph.Permission{}
|
||||
|
||||
err = json.Unmarshal(data, &res)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, ok := res.GetRolesOk()
|
||||
Expect(ok).To(BeTrue())
|
||||
})
|
||||
// err = json.Unmarshal(data, &res)
|
||||
// Expect(err).ToNot(HaveOccurred())
|
||||
// _, ok := res.GetRolesOk()
|
||||
// Expect(ok).To(BeTrue())
|
||||
// })
|
||||
It("fails to update the share permissions for a file share when setting a space specific role", func() {
|
||||
getPublicShareMockResponse.Share = nil
|
||||
getPublicShareMockResponse.Status = status.NewNotFound(ctx, "not found")
|
||||
|
||||
@@ -32,7 +32,7 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/errorcode"
|
||||
identitymocks "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
|
||||
service "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole"
|
||||
// "github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole"
|
||||
)
|
||||
|
||||
var _ = Describe("SharedWithMe", func() {
|
||||
@@ -351,26 +351,28 @@ var _ = Describe("SharedWithMe", func() {
|
||||
Expect(jsonData.Get("file.mimeType").String()).To(Equal(resourceInfo.MimeType))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.permissions properties", func() {
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.PermissionSet = roleconversions.NewViewerRole(true).CS3ResourcePermissions()
|
||||
// that is resharing test. Please delete after disable resharing feature
|
||||
|
||||
// It("populates the driveItem.remoteItem.permissions properties", func() {
|
||||
// resourceInfo := statResponse.Info
|
||||
// resourceInfo.PermissionSet = roleconversions.NewViewerRole(false).CS3ResourcePermissions()
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
// svc.ListSharedWithMe(
|
||||
// tape,
|
||||
// httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
// )
|
||||
|
||||
driveitemJSON := gjson.Get(tape.Body.String(), "value.0")
|
||||
Expect(driveitemJSON.Get("@UI\\.Hidden").Exists()).To(BeTrue())
|
||||
Expect(driveitemJSON.Get("@UI\\.Hidden").Bool()).To(BeFalse())
|
||||
Expect(driveitemJSON.Get("@client\\.synchronize").Exists()).To(BeTrue())
|
||||
Expect(driveitemJSON.Get("@client\\.synchronize").Bool()).To(BeTrue())
|
||||
// driveitemJSON := gjson.Get(tape.Body.String(), "value.0")
|
||||
// Expect(driveitemJSON.Get("@UI\\.Hidden").Exists()).To(BeTrue())
|
||||
// Expect(driveitemJSON.Get("@UI\\.Hidden").Bool()).To(BeFalse())
|
||||
// Expect(driveitemJSON.Get("@client\\.synchronize").Exists()).To(BeTrue())
|
||||
// Expect(driveitemJSON.Get("@client\\.synchronize").Bool()).To(BeTrue())
|
||||
|
||||
permissionsJSON := driveitemJSON.Get("remoteItem.permissions.0")
|
||||
Expect(permissionsJSON.Get("id").String()).To(Equal(listReceivedSharesResponse.Shares[0].Share.Id.OpaqueId))
|
||||
Expect(permissionsJSON.Get("roles.0").String()).To(Equal(unifiedrole.UnifiedRoleViewerID))
|
||||
Expect(permissionsJSON.Get("invitation.invitedBy.user.id").String()).To(Equal(getUserResponseShareCreator.User.Id.OpaqueId))
|
||||
})
|
||||
// permissionsJSON := driveitemJSON.Get("remoteItem.permissions.0")
|
||||
// Expect(permissionsJSON.Get("id").String()).To(Equal(listReceivedSharesResponse.Shares[0].Share.Id.OpaqueId))
|
||||
// Expect(permissionsJSON.Get("roles.0").String()).To(Equal(unifiedrole.UnifiedRoleViewerID))
|
||||
// Expect(permissionsJSON.Get("invitation.invitedBy.user.id").String()).To(Equal(getUserResponseShareCreator.User.Id.OpaqueId))
|
||||
// })
|
||||
|
||||
It("returns shares created on project space", func() {
|
||||
ownerID := &userv1beta1.UserId{
|
||||
|
||||
Reference in New Issue
Block a user