Skip to content

Commit

Permalink
Merge pull request #4422 from owncloud/move-graph-test-to-ocis-local
Browse files Browse the repository at this point in the history
[full-ci] [tests-only] Added test for creating group with case sensitive
  • Loading branch information
SwikritiT authored Aug 25, 2022
2 parents b57bdc0 + 07af854 commit 9ceaf14
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
10 changes: 9 additions & 1 deletion tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default:
apiAccountsHashDifficulty:
paths:
- '%paths.base%/../features/apiAccountsHashDifficulty'
context:
context: &common_ldap_suite_context
parameters:
ldapAdminPassword: admin
ldapUsersOU: TestUsers
Expand Down Expand Up @@ -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: ~
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ The expected failures in this file are from features in the owncloud/ocis repo.

### [Search by shares jail works incorrect](https://github.com/owncloud/ocis/issues/4014)
- [apiSpaces/search.feature:43](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/search.feature#L43)

### [create request for already existing user exits with status code 500 ](https://github.com/owncloud/ocis/issues/3516)
- [apiGraph/createGroupCaseSensitive.feature:16](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L16)
- [apiGraph/createGroupCaseSensitive.feature:17](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L17)
- [apiGraph/createGroupCaseSensitive.feature:18](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L18)
- [apiGraph/createGroupCaseSensitive.feature:19](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L19)
- [apiGraph/createGroupCaseSensitive.feature:20](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L20)
- [apiGraph/createGroupCaseSensitive.feature:21](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroupCaseSensitive.feature#L21)
Original file line number Diff line number Diff line change
@@ -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 "<ocs_api_version>"
And group "<group_id1>" has been created
When the administrator creates a group "<group_id2>" using the Graph API
And the administrator creates a group "<group_id3>" using the Graph API
Then the HTTP status code of responses on all endpoints should be "400"
And these groups should not exist:
| groupname |
| <group_id2> |
| <group_id3> |
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 |
26 changes: 26 additions & 0 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 9ceaf14

Please sign in to comment.