From bda340770791256088da5be678376d6910c69e6e Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 19 Aug 2022 17:16:12 +0545 Subject: [PATCH] Added test for creating group with case sensitive --- .drone.star | 1 + tests/acceptance/config/behat.yml | 10 ++++++- ...ected-failures-localAPI-on-OCIS-storage.md | 2 ++ .../apiGraph/createGroupCaseSensitive.feature | 21 +++++++++++++++ .../features/bootstrap/GraphContext.php | 26 +++++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature diff --git a/.drone.star b/.drone.star index 95fe42377fe..2ad14a48fda 100644 --- a/.drone.star +++ b/.drone.star @@ -339,6 +339,7 @@ def testPipelines(ctx): localApiTests(ctx, "ocis", "apiAccountsHashDifficulty"), localApiTests(ctx, "ocis", "apiSpaces"), localApiTests(ctx, "ocis", "apiArchiver"), + localApiTests(ctx, "ocis", "apiGraph"), ] if "skip" not in config["apiTests"] or not config["apiTests"]["skip"]: diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 6d50a05fac4..c2afae62f6f 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -6,7 +6,7 @@ default: apiAccountsHashDifficulty: paths: - '%paths.base%/../features/apiAccountsHashDifficulty' - context: + context: &common_ldap_suite_context parameters: ldapAdminPassword: admin ldapUsersOU: TestUsers @@ -58,5 +58,13 @@ default: - FilesVersionsContext: - PublicWebDavContext: + apiGraph: + paths: + - '%paths.base%/../features/apiGraph' + context: *common_ldap_suite_context + contexts: + - GraphContext: + - FeatureContext: *common_feature_context_params + extensions: Cjm\Behat\StepThroughExtension: ~ diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 0170f03fe79..685d182b68e 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -25,3 +25,5 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [Changing personal drive quota on another user as admin is not possible](https://github.com/owncloud/ocis/issues/4325) - [apiSpaces/changeSpaces.feature:221](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changeSpaces.feature#L221) +### [create request for already existing user exits with status code 500 ](https://github.com/owncloud/ocis/issues/3516) +- [apiGraph/createGroupCaseSensitive.feature:4](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L4) diff --git a/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature b/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature new file mode 100644 index 00000000000..d29236562b8 --- /dev/null +++ b/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature @@ -0,0 +1,21 @@ +@api +Feature: create groups, group names are case insensitive + + Scenario Outline: group names are case insensitive, creating groups with different upper and lower case names + Given using OCS API version "" + And group "" has been created + When the administrator creates a group "" using the Graph API + And the administrator creates a group "" using the Graph API + Then the HTTP status code of responses on all endpoints should be "400" + And these groups should not exist: + | groupname | + | | + | | + Examples: + | ocs_api_version | group_id1 | group_id2 | group_id3 | + | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | + | 1 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | + | 1 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | + | 2 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | + | 2 | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group | + | 2 | CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group | diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 062975342d3..ac45b1e7e8b 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -428,6 +428,32 @@ public function adminHasAddedUserToGroupUsingTheGraphApi( } } + /** + * @When /^the administrator creates a group "([^"]*)" using the Graph API$/ + * + * @param string $group + * + * @return void + * @throws Exception + * @throws GuzzleException + */ + public function adminCreatesGroupUsingTheGraphApi(string $group): void { + $response = GraphHelper::createGroup( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $this->featureContext->getAdminUsername(), + $this->featureContext->getAdminPassword(), + $group, + ); + $this->featureContext->setResponse($response); + $this->featureContext->pushToLastHttpStatusCodesArray((string) $response->getStatusCode()); + + if ($response->getStatusCode() === 200) { + $groupId = $this->featureContext->getJsonDecodedResponse($response)["id"]; + $this->featureContext->addGroupToCreatedGroupsList($group, true, true, $groupId); + } + } + /** * create group with provided data *