From 7c2e70f8b670d7f8ae9e10dd01bcd97e2060a313 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Sun, 12 Dec 2021 17:34:04 +0100 Subject: [PATCH] fix api tests --- go.mod | 2 +- .../features/apiSpaces/changeSpaces.feature | 9 ++++----- .../acceptance/features/bootstrap/SpacesContext.php | 12 ++++++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 350a659b4..d395cdd17 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/blevesearch/bleve/v2 v2.2.2 github.com/coreos/go-oidc/v3 v3.1.0 github.com/cs3org/go-cs3apis v0.0.0-20211104090126-8e972dca8304 - github.com/cs3org/reva v1.17.0 + github.com/cs3org/reva v1.17.1-0.20211212151213-778de37266ff github.com/disintegration/imaging v1.6.2 github.com/glauth/glauth/v2 v2.0.0-20211021011345-ef3151c28733 github.com/go-chi/chi/v5 v5.0.7 diff --git a/tests/acceptance/features/apiSpaces/changeSpaces.feature b/tests/acceptance/features/apiSpaces/changeSpaces.feature index 8a00e08ef..1397ace3f 100644 --- a/tests/acceptance/features/apiSpaces/changeSpaces.feature +++ b/tests/acceptance/features/apiSpaces/changeSpaces.feature @@ -11,9 +11,9 @@ Feature: Change data of space And the administrator has given "Alice" the role "Admin" using the settings api Scenario: Alice changes a name of the space via the Graph api, she expects a 204 code and checks that the space name has changed - Given user "Alice" has created a space "Project Jupiter" of type "project" with quota "20" + Given user "Alice" has created a space "Project Jupiter" of type "project" with quota "20" When user "Alice" changes the name of the "Project Jupiter" space to "Project Death Star" - Then the HTTP status code should be "204" + Then the HTTP status code should be "200" When user "Alice" lists all available spaces via the GraphApi Then the json responded should contain a space "Project Death Star" with these key and value pairs: | key | value | @@ -23,12 +23,11 @@ Feature: Change data of space | root@@@webDavUrl | %base_url%/dav/spaces/%space_id% | Scenario: Alice increases quota of the space via the Graph api, she expects a 204 code and checks that the quota has changed - Given user "Alice" has created a space "Project Earth" of type "project" with quota "20" + Given user "Alice" has created a space "Project Earth" of type "project" with quota "20" When user "Alice" changes the quota of the "Project Earth" space to "100" - Then the HTTP status code should be "204" + Then the HTTP status code should be "200" When user "Alice" lists all available spaces via the GraphApi Then the json responded should contain a space "Project Earth" with these key and value pairs: | key | value | | name | Project Earth | | quota@@@total | 100 | - \ No newline at end of file diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index c58954105..bfe573f16 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -187,11 +187,11 @@ class SpacesContext implements Context { */ public function getSpaceByName(string $user, string $name): array { $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user); - + $spaces = $this->getAvailableSpaces(); Assert::assertIsArray($spaces[$name], "Space with name $name for user $user not found"); Assert::assertNotEmpty($spaces[$name]["root"]["webDavUrl"], "WebDavUrl for space with name $name for user $user not found"); - + return $spaces[$name]; } @@ -802,7 +802,7 @@ class SpacesContext implements Context { string $spaceName ): void { $space = $this->getSpaceByName($user, $spaceName); - + $baseUrl = $this->featureContext->getBaseUrl(); if (!str_ends_with($baseUrl, '/')) { $baseUrl .= '/'; @@ -838,7 +838,7 @@ class SpacesContext implements Context { string $ownerUser ): void { $space = $this->getSpaceByName($ownerUser, $spaceName); - + $baseUrl = $this->featureContext->getBaseUrl(); if (!str_ends_with($baseUrl, '/')) { $baseUrl .= '/'; @@ -1044,7 +1044,7 @@ class SpacesContext implements Context { if (!str_ends_with($fullUrl, '/')) { $fullUrl .= '/'; } - $fullUrl .= "graph/v1.0/Drive($spaceId)"; + $fullUrl .= "graph/v1.0/drives/$spaceId"; $method = 'PATCH'; return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers, $body); @@ -1090,7 +1090,7 @@ class SpacesContext implements Context { */ public function userHasUploadedFile(string $user, string $spaceName, string $fileContent, string $destination):void { $this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user); - + $space = $this->getSpaceByName($user, $spaceName); Assert::assertIsArray($space, "Space with name $spaceName not found"); Assert::assertNotEmpty($space["root"]["webDavUrl"], "WebDavUrl for space with name $spaceName not found");