From a2bdbc8b56521f07b23f6fd954dd1d7fb3068128 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Tue, 28 Jul 2026 13:19:26 +0200 Subject: [PATCH] api-test: fix removeAccessToDrive.feature:145 (#3179) * api-test: fix removeAccessToDrive.feature:145 * fix after review --- .../acceptance/bootstrap/SharingNgContext.php | 34 +++++++++++++++++++ .../expected-failures-decomposed-storage.md | 4 --- .../expected-failures-posix-storage.md | 4 --- .../apiSharingNg1/removeAccessToDrive.feature | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 19c7101d7a..26aaf215ea 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -1030,6 +1030,21 @@ class SharingNgContext implements Context { if ($shareType == 'user' && !isset($recipient)) { $this->featureContext->shareNgAddToCreatedUserGroupShares($this->getDrivePermissionsList($sharer, $space)); $permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); + } elseif ($shareType == 'group' && !isset($recipient)) { + // https://github.com/opencloud-eu/opencloud/pull/3179#issuecomment-5103212045 + $retried = 0; + do { + $response = $this->getDrivePermissionsList($sharer, $space); + $tryAgain = $response->getStatusCode() === 404 + && $retried < HttpRequestHelper::numRetriesOnHttpTooEarly(); + if ($tryAgain) { + $retried += 1; + echo "Drive permissions of space '$space' not available for user '$sharer' yet, retrying ($retried)...\n"; + // wait 500ms and try again + \usleep(500 * 1000); + } + } while ($tryAgain); + $permissionID = $this->featureContext->getJsonDecodedResponse($response)['value'][0]['id']; } else { $permissionID = match ($shareType) { 'link' => $this->featureContext->shareNgGetLastCreatedLinkShareID(), @@ -1206,6 +1221,25 @@ class SharingNgContext implements Context { ); } + /** + * + * @param string $user + * @param string $space + * + * @return void + * @throws JsonException + * @throws GuzzleException + */ + #[When('user :user tries to remove own group access from space :space using root endpoint of the Graph API')] + public function userRemovesOwnAccessOfGroupFromSpaceUsingGraphAPI( + string $user, + string $space + ): void { + $this->featureContext->setResponse( + $this->removeAccessToSpace($user, 'group', $space) + ); + } + /** * * @param string $user diff --git a/tests/acceptance/expected-failures-decomposed-storage.md b/tests/acceptance/expected-failures-decomposed-storage.md index 344f0d7523..5e93d5f941 100644 --- a/tests/acceptance/expected-failures-decomposed-storage.md +++ b/tests/acceptance/expected-failures-decomposed-storage.md @@ -339,10 +339,6 @@ _ocdav: api compatibility, return correct status code_ - [coreApiWebdavPreviews/previews.feature:265](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavPreviews/previews.feature#L265) -#### [500 when user tries to delete group from space](https://github.com/opencloud-eu/opencloud/issues/2799) - -- [apiSharingNg1/removeAccessToDrive.feature:145](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature#L145) - #### [POSIX: failing CLI commands](https://github.com/opencloud-eu/opencloud/issues/3095) - [cliCommands/restoreTrashBinItems.feature:11](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/cliCommands/restoreTrashBinItems.feature#L11) diff --git a/tests/acceptance/expected-failures-posix-storage.md b/tests/acceptance/expected-failures-posix-storage.md index ca1b3f1e65..035b126b91 100644 --- a/tests/acceptance/expected-failures-posix-storage.md +++ b/tests/acceptance/expected-failures-posix-storage.md @@ -342,10 +342,6 @@ _ocdav: api compatibility, return correct status code_ - [coreApiWebdavPreviews/previews.feature:264](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavPreviews/previews.feature#L264) - [coreApiWebdavPreviews/previews.feature:265](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavPreviews/previews.feature#L265) -### TODO: adjust test - -- [apiSharingNg1/removeAccessToDrive.feature:145](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature#L145) - tests/acceptance/features/cliCommands/restoreTrashBinItems.feature #### [POSIX: failing CLI commands](https://github.com/opencloud-eu/opencloud/issues/3095) diff --git a/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature b/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature index fc0ef75634..312a410125 100644 --- a/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature +++ b/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature @@ -153,7 +153,7 @@ Feature: Remove access to a drive | shareType | group | | permissionsRole | Manager | And user "Alice" has removed own access from space "NewSpace" - When user "Brian" tries to remove the access of group "group1" from space "NewSpace" using root endpoint of the Graph API + When user "Brian" tries to remove own group access from space "NewSpace" using root endpoint of the Graph API Then the HTTP status code should be "403" And the user "Brian" should have a space called "NewSpace"