Skip to content

Commit

Permalink
delete re-sharing tests
Browse files Browse the repository at this point in the history
delete re-sharing tests
  • Loading branch information
ScharfViktor committed Mar 26, 2024
1 parent c65cf6b commit 85c471b
Show file tree
Hide file tree
Showing 35 changed files with 348 additions and 1,628 deletions.
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OC_CI_PHP = "owncloudci/php:%s"
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
OC_CS3_API_VALIDATOR = "owncloud/cs3api-validator:0.2.1"
OC_LITMUS = "owncloudci/litmus:latest"
OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.8.8"
OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:latest"
OC_UBUNTU = "owncloud/ubuntu:20.04"
PLUGINS_CODACY = "plugins/codacy:1"
PLUGINS_DOCKER = "plugins/docker:latest"
Expand Down
61 changes: 31 additions & 30 deletions services/graph/pkg/service/v0/driveitems_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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{}

err = json.Unmarshal(data, &res)
Expect(err).ToNot(HaveOccurred())
_, ok := res.GetRolesOk()
Expect(ok).To(BeTrue())
})
// 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())

// res := libregraph.Permission{}

// 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")
Expand Down
44 changes: 23 additions & 21 deletions services/graph/pkg/service/v0/sharedwithme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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()

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())

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))
})
// 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),
// )

// 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))
// })

It("returns shares created on project space", func() {
ownerID := &userv1beta1.UserId{
Expand Down
4 changes: 3 additions & 1 deletion tests/TestHelpers/SharingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class SharingHelper {
'update' => 2,
'create' => 4,
'delete' => 8,
'share' => 16,
'invite' => 0
];

Expand Down Expand Up @@ -123,6 +122,9 @@ public static function createShare(

if ($permissions !== null) {
$fd['permissions'] = self::getPermissionSum($permissions);
} elseif ($shareType !== "public_link") {
// sharing without permissions should automatically set the permission to 15 for share and 1 for public link
$fd['permissions'] = 15;
}

if (!\in_array($ocsApiVersion, [1, 2], true)) {
Expand Down
20 changes: 0 additions & 20 deletions tests/acceptance/config/behat-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,6 @@ default:
- WebDavPropertiesContext:
- OcisConfigContext:

coreApiShareReshareToShares1:
paths:
- "%paths.base%/../features/coreApiShareReshareToShares1"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- PublicWebDavContext:
- TrashbinContext:
- WebDavPropertiesContext:

coreApiShareReshareToShares2:
paths:
- "%paths.base%/../features/coreApiShareReshareToShares2"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- PublicWebDavContext:
- TrashbinContext:
- WebDavPropertiesContext:

coreApiShareUpdateToShares:
paths:
- "%paths.base%/../features/coreApiShareUpdateToShares"
Expand Down
40 changes: 8 additions & 32 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ File and sync features in a shared scenario
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:159](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L159)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:160](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L160)

#### [sharing the shares folder to users exits with different status code than in oc10 backend](https://github.com/owncloud/ocis/issues/2215)

- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:654](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L654)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:655](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L655)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:672](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L672)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:673](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L673)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:687](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L687)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:688](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L688)

#### [file_target of an auto-renamed file is not correct directly after sharing](https://github.com/owncloud/core/issues/32322)

Expand Down Expand Up @@ -133,29 +125,13 @@ cannot share a folder with create permission
- [coreApiTrashbin/trashbinSharingToShares.feature:201](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature#L201)
- [coreApiTrashbin/trashbinSharingToShares.feature:224](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature#L224)

#### [Expiration date for shares is not implemented](https://github.com/owncloud/ocis/issues/1250)

#### Expiration date of user shares

- [coreApiShareReshareToShares2/reShareWithExpiryDate.feature:33](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareReshareToShares2/reShareWithExpiryDate.feature#L33)
- [coreApiShareReshareToShares2/reShareWithExpiryDate.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareReshareToShares2/reShareWithExpiryDate.feature#L34)

#### Expiration date of group shares

- [coreApiShareReshareToShares2/reShareWithExpiryDate.feature:56](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareReshareToShares2/reShareWithExpiryDate.feature#L56)
- [coreApiShareReshareToShares2/reShareWithExpiryDate.feature:57](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareReshareToShares2/reShareWithExpiryDate.feature#L57)

#### [Cannot move folder/file from one received share to another](https://github.com/owncloud/ocis/issues/2442)

- [coreApiShareUpdateToShares/updateShare.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L124)
- [coreApiShareUpdateToShares/updateShare.feature:154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L154)

#### [Sharing folder and sub-folder with same user but different permission,the permission of sub-folder is not obeyed ](https://github.com/owncloud/ocis/issues/2440)

- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:213](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L213)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:239](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L239)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:324](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L324)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:350](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L350)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:292](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#292)
- [coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature:318](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareReceivedInMultipleWays.feature#L318)

#### [Empty OCS response for a share create request using a disabled user](https://github.com/owncloud/ocis/issues/2212)

Expand All @@ -164,13 +140,13 @@ cannot share a folder with create permission

#### [Edit user share response has a "name" field](https://github.com/owncloud/ocis/issues/1225)

- [coreApiShareUpdateToShares/updateShare.feature:227](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L227)
- [coreApiShareUpdateToShares/updateShare.feature:228](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L228)
- [coreApiShareUpdateToShares/updateShare.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L161)
- [coreApiShareUpdateToShares/updateShare.feature:162](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareUpdateToShares/updateShare.feature#L162)

#### [Share lists deleted user as 'user'](https://github.com/owncloud/ocis/issues/903)

- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:594](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L594)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:595](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L595)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:544](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L544)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:545](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L545)

#### [deleting a share with wrong authentication returns OCS status 996 / HTTP 500](https://github.com/owncloud/ocis/issues/1229)

Expand Down Expand Up @@ -278,8 +254,8 @@ And other missing implementation of favorites

#### [Sharing a same file twice to the same group](https://github.com/owncloud/ocis/issues/1710)

- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:638](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L638)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:639](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L639)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:588](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L588)
- [coreApiShareManagementBasicToShares/createShareToSharesFolder.feature:589](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareManagementBasicToShares/createShareToSharesFolder.feature#L589)

#### [PATCH request for TUS upload with wrong checksum gives incorrect response](https://github.com/owncloud/ocis/issues/1755)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The expected failures in this file are from features in the owncloud/ocis repo.

### [Shared mount folder gets deleted when overwritten by a file from personal space](https://github.com/owncloud/ocis/issues/7208)

- [apiSpacesShares/copySpaces.feature:510](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L510)
- [apiSpacesShares/copySpaces.feature:523](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L523)
- [apiSpacesShares/copySpaces.feature:512](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L512)
- [apiSpacesShares/copySpaces.feature:525](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L525)

#### [PATCH request for TUS upload with wrong checksum gives incorrect response](https://github.com/owncloud/ocis/issues/1755)

Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/apiContract/sharesReport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: REPORT request to Shares space
And user "Alice" has created folder "/folderMain"
And user "Alice" has created folder "/folderMain/SubFolder1"
And user "Alice" has created folder "/folderMain/SubFolder1/subFOLDER2"
And user "Alice" has shared entry "/folderMain" with user "Brian" with permissions "17"
And user "Alice" has shared entry "/folderMain" with user "Brian" with permissions "1"


Scenario Outline: check the REPORT response of the found folder
Expand Down Expand Up @@ -60,7 +60,7 @@ Feature: REPORT request to Shares space
Given user "Brian" has disabled auto-accepting
And using <dav-path-version> DAV path
And user "Alice" has created folder "/folderToBrian"
And user "Alice" has shared entry "/folderToBrian" with user "Brian" with permissions "17"
And user "Alice" has shared entry "/folderToBrian" with user "Brian" with permissions "1"
When user "Brian" searches for "folderToBrian" using the WebDAV API
Then the HTTP status code should be "207"
And the following headers should match these regular expressions
Expand Down
5 changes: 0 additions & 5 deletions tests/acceptance/features/apiGraph/userGDPRExport.feature
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ Feature: user GDPR (General Data Protection Regulation) report
"permissions": {
"type": "object",
"required": [
"add_grant",
"get_path",
"get_quota",
"initiate_file_download",
Expand All @@ -634,10 +633,6 @@ Feature: user GDPR (General Data Protection Regulation) report
"stat"
],
"properties": {
"add_grant" : {
"type": "boolean",
"enum": [true]
},
"get_path" : {
"type": "boolean",
"enum": [true]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Feature: Email notification

Scenario: user gets an email notification when someone shares a file
Given user "Alice" has uploaded file with content "sample text" to "lorem.txt"
When user "Alice" shares file "lorem.txt" with user "Brian" with permissions "17" using the sharing API
When user "Alice" shares file "lorem.txt" with user "Brian" using the sharing API
Then the HTTP status code should be "200"
And the OCS status code should be "100"
And user "Brian" should have received the following email from user "Alice"
Expand Down
Loading

0 comments on commit 85c471b

Please sign in to comment.