From 76b0e744a7ec5bf0380fb1448edb22af6fbf459c Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Thu, 25 May 2023 14:47:32 +0200 Subject: [PATCH] [tests-only] Api tests for checking conflict status code while creating folder (#6389) * add tests for checking conflict status code while creating folder * fix after review --- .../features/apiSpaces/uploadSpaces.feature | 17 ++++++++++++++++- .../features/bootstrap/SpacesContext.php | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 2b890b10bc..dc2451fafb 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -1,4 +1,4 @@ -@api +@api Feature: Upload files into a space As a user I want to be able to create folders and files in the space @@ -75,3 +75,18 @@ Feature: Upload files into a space And for user "Alice" the space "Project Ceres" should not contain these entries: | forAlice | | test.txt | + + + Scenario: user cannot create folder with an existing name + Given user "Alice" has created a folder "NewFolder" in space "Project Ceres" + When user "Alice" creates a folder "NewFolder" in space "Project Ceres" using the WebDav Api + Then the HTTP status code should be "405" + + + Scenario Outline: user cannot create subfolder in a nonexistent folder + When user "Alice" tries to create subfolder "" in a nonexistent folder of the space "Project Ceres" using the WebDav Api + Then the HTTP status code should be "409" + Examples: + | path | + | foo/bar | + | foo/bar/baz | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 3b7c2d09d0..4608d43f05 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1139,6 +1139,25 @@ class SpacesContext implements Context { } } + /** + * @When /^user "([^"]*)" tries to create subfolder "([^"]*)" in a nonexistent folder of the space "([^"]*)" using the WebDav Api$/ + * + * @param string $user + * @param string $subfolder + * @param string $spaceName + * + * @return void + * + * @throws GuzzleException + */ + public function theUserTriesToCreateASubFolderUsingTheGraphApi( + string $user, + string $subfolder, + string $spaceName + ): void { + $this->theUserCreatesAFolderToAnotherOwnerSpaceUsingTheGraphApi($user, $subfolder, $spaceName); + } + /** * @Given /^user "([^"]*)" has created a (?:folder|subfolder) "([^"]*)" in space "([^"]*)"$/ *