From 7423fa3a4b4f45e65e91e4ebadcdf15e45ab6b14 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Thu, 2 May 2024 14:30:01 +0545 Subject: [PATCH] Use sharingNG for sharing in given step, refactored accordingly --- tests/acceptance/config/behat.yml | 1 + .../enforcePasswordPublicLink.feature | 32 +++++---- .../features/apiGraph/userGDPRExport.feature | 65 ++++++++----------- .../bootstrap/PublicWebDavContext.php | 9 ++- .../acceptance/features/bootstrap/Sharing.php | 2 +- 5 files changed, 56 insertions(+), 53 deletions(-) diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 276f57e41..42cf9d8ff 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -121,6 +121,7 @@ default: - SpacesTUSContext: - OcisConfigContext: - TrashbinContext: + - SharingNgContext: apiGraphUserGroup: paths: diff --git a/tests/acceptance/features/apiGraph/enforcePasswordPublicLink.feature b/tests/acceptance/features/apiGraph/enforcePasswordPublicLink.feature index 5848a286c..376f1182d 100644 --- a/tests/acceptance/features/apiGraph/enforcePasswordPublicLink.feature +++ b/tests/acceptance/features/apiGraph/enforcePasswordPublicLink.feature @@ -60,9 +60,11 @@ Feature: enforce password on public link And user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "test file" to "/testfile.txt" And using OCS API version "" - And user "Alice" has created a public link share with settings - | path | /testfile.txt | - | permissions | 1 | + And using SharingNG + And user "Alice" has created the following link share: + | resource | testfile.txt | + | space | Personal | + | permissionsRole | view | When user "Alice" updates the last public link share using the sharing API with | permissions | 3 | | password | %public% | @@ -150,9 +152,11 @@ Feature: enforce password on public link And user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "test file" to "/testfile.txt" And using OCS API version "" - And user "Alice" has created a public link share with settings - | path | /testfile.txt | - | permissions | 1 | + And using SharingNG + And user "Alice" has created the following link share: + | resource | testfile.txt | + | space | Personal | + | permissionsRole | view | When user "Alice" updates the last public link share using the sharing API with | permissions | 3 | | password | 6a0Q;A3 +i^m[ | @@ -181,9 +185,11 @@ Feature: enforce password on public link And user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "test file" to "/testfile.txt" And using OCS API version "" - And user "Alice" has created a public link share with settings - | path | /testfile.txt | - | permissions | 1 | + And using SharingNG + And user "Alice" has created the following link share: + | resource | testfile.txt | + | space | Personal | + | permissionsRole | view | When user "Alice" updates the last public link share using the sharing API with | permissions | 3 | | password | Pws^ | @@ -254,9 +260,11 @@ Feature: enforce password on public link And using OCS API version "2" And user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "test file" to "/testfile.txt" - And user "Alice" has created a public link share with settings - | path | /testfile.txt | - | permissions | 0 | + And using SharingNG + And user "Alice" has created the following link share: + | resource | testfile.txt | + | space | Personal | + | permissionsRole | internal | When user "Alice" updates the last public link share using the sharing API with | permissions | 3 | | password | | diff --git a/tests/acceptance/features/apiGraph/userGDPRExport.feature b/tests/acceptance/features/apiGraph/userGDPRExport.feature index c1c2e11ce..e493fcf3a 100644 --- a/tests/acceptance/features/apiGraph/userGDPRExport.feature +++ b/tests/acceptance/features/apiGraph/userGDPRExport.feature @@ -586,7 +586,12 @@ Feature: user GDPR (General Data Protection Regulation) report Scenario: generate a GDPR report and check events when a user shares a folder Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/folderMain" - And user "Alice" has shared entry "/folderMain" with user "Brian" + And user "Alice" has sent the following share invitation: + | resource | folderMain | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API And user "Alice" downloads the content of GDPR report ".personal_data_export.json" Then the HTTP status code of responses on each endpoint should be "202, 200" respectively @@ -709,10 +714,12 @@ Feature: user GDPR (General Data Protection Regulation) report Scenario: generate a GDPR report and check events when a user creates a public link share Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/folderMain" - And user "Alice" has created a public link share with settings - | path | /folderMain | - | name | sharedlink | - | password | %public% | + And user "Alice" has created the following link share: + | resource | folderMain | + | space | Personal | + | permissionsRole | view | + | password | %public% | + | displayName | sharedlink | When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API And user "Alice" downloads the content of GDPR report ".personal_data_export.json" Then the HTTP status code of responses on each endpoint should be "202, 200" respectively @@ -854,9 +861,11 @@ Feature: user GDPR (General Data Protection Regulation) report Given user "Brian" has been created with default attributes and without skeleton files And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "GDPR Space" with the default quota using the Graph API - And user "Alice" has shared a space "GDPR Space" with settings: - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following share invitation: + | space | GDPR Space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Viewer | When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API And user "Alice" downloads the content of GDPR report ".personal_data_export.json" Then the HTTP status code of responses on each endpoint should be "202, 200" respectively @@ -864,9 +873,7 @@ Feature: user GDPR (General Data Protection Regulation) report """ { "type": "object", - "required": [ - "event" - ], + "required": ["event", "type"], "properties": { "event": { "type": "object", @@ -879,11 +886,7 @@ Feature: user GDPR (General Data Protection Regulation) report "properties": { "Creator": { "type": "object", - "required": [ - "idp", - "opaque_id", - "type" - ], + "required": ["idp", "opaque_id", "type"], "properties": { "idp": { "type": "string", @@ -895,17 +898,13 @@ Feature: user GDPR (General Data Protection Regulation) report }, "type": { "type": "number", - "enum": [1] + "const": 1 } } }, "Executant": { "type": "object", - "required": [ - "idp", - "opaque_id", - "type" - ], + "required": ["idp", "opaque_id", "type"], "properties": { "idp": { "type": "string", @@ -917,37 +916,29 @@ Feature: user GDPR (General Data Protection Regulation) report }, "type": { "type": "number", - "enum": [1] + "const": 1 } } }, "GranteeGroupID": { "type": ["number", "null"], - "enum": [null] + "const": null }, "GranteeUserID": { "type": "object", - "required": [ - "idp", - "opaque_id", - "type" - ], + "required": ["opaque_id"], "properties": { - "idp": { - "type": "string", - "pattern": "^%base_url%$" - }, "opaque_id": { "type": "string", "pattern": "^%user_id_pattern%$" - }, - "type": { - "type": "number", - "enum": [1] } } } } + }, + "type": { + "type": "string", + "const": "events.SpaceShared" } } } diff --git a/tests/acceptance/features/bootstrap/PublicWebDavContext.php b/tests/acceptance/features/bootstrap/PublicWebDavContext.php index 49297dd7b..df1c72de0 100644 --- a/tests/acceptance/features/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/features/bootstrap/PublicWebDavContext.php @@ -918,7 +918,8 @@ class PublicWebDavContext implements Context { $publicWebDAVAPIVersion, "", "", - $expectedHttpCode + $expectedHttpCode, + $this->featureContext->isUsingSharingNG() ); } @@ -944,7 +945,8 @@ class PublicWebDavContext implements Context { $path, $password, "", - $publicWebDAVAPIVersion + $publicWebDAVAPIVersion, + $this->featureContext->isUsingSharingNG() ); $this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response); } @@ -1093,7 +1095,8 @@ class PublicWebDavContext implements Context { $publicWebDAVAPIVersion, $password, "", - $expectedHttpCode + $expectedHttpCode, + $this->featureContext->isUsingSharingNG() ); } diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 086e8dcef..d7bcea8fb 100755 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -754,7 +754,7 @@ trait Sharing { $user = $this->getActualUsername($user); if ($updateLastPublicLink) { - $share_id = (string) $this->getLastCreatedPublicShare()->id; + $share_id = (FeatureContext::isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareID() : (string) $this->getLastCreatedPublicShare()->id; } else { if ($shareOwner === null) { $share_id = $this->getLastCreatedUserGroupShareId();