fix api tests

This commit is contained in:
Michael Barz
2021-12-12 17:34:04 +01:00
parent 6e73ee7466
commit 7c2e70f8b6
3 changed files with 11 additions and 12 deletions

2
go.mod
View File

@@ -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

View File

@@ -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 |

View File

@@ -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");