From d10d361daf30f326a6eccc8627d2732e7725cbc4 Mon Sep 17 00:00:00 2001 From: pradip Date: Tue, 1 Oct 2024 15:30:42 +0545 Subject: [PATCH] test: Test coverage for bug #10051 --- .../acceptance/bootstrap/SharingNgContext.php | 18 ++++++ .../acceptance/features/apiOcm/share.feature | 55 +++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 394cf9626c0..3628dffcb08 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -1803,4 +1803,22 @@ public function theJsonResponseShouldContainTheFollowingShares(TableNode $table) ); } } + + /** + * @When /^user "([^"]*)" sends the following space share invitation to federated user using the Graph API:$/ + * + * @param string $user + * @param TableNode $table + * + * @return void + * @throws Exception + * @throws GuzzleException + */ + public function userSendsTheFollowingSpaceShareInvitationToFederatedUserUsingTheGraphApi(string $user, TableNode $table): void { + $rows = $table->getRowsHash(); + Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space"); + $this->featureContext->setResponse( + $this->sendShareInvitation($user, $rows, null, true) + ); + } } diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index 97c554b4ed5..284adb8d07a 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -171,3 +171,58 @@ Feature: an user shares resources usin ScienceMesh application } } """ + + + Scenario Outline: user tries to add federated user to a space + Given using server "LOCAL" + And using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And "Alice" has created the federation share invitation + And using server "REMOTE" + And "Brian" has accepted invitation + And using server "LOCAL" + When user "Alice" sends the following space share invitation to federated user using the Graph API: + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | | + | federatedServer | @federation-ocis-server:10200 | + Then the HTTP status code should be "400" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["error"], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "innererror", + "message" + ], + "properties": { + "code" : { + "const": "invalidRequest" + }, + "innererror" : { + "type": "object", + "required": [ + "date", + "request-id" + ] + }, + "message" : { + "const": "federated user can not become a space member" + } + } + } + } + } + """ + Examples: + | permissions-role | + | Space Viewer | + | Space Editor | + | Manager |