Skip to content

Commit

Permalink
Added test for creating group with case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
grgprarup committed Aug 19, 2022
1 parent d1f0dbc commit 02dff34
Show file tree
Hide file tree
Showing 4 changed files with 57 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
@@ -0,0 +1,21 @@
@api
Feature: create groups, group names are case insensitive

Scenario Outline: group names are case insensitive, creating a 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 tries to create a group "<group_id2>" using the GraphApi
And the administrator tries to create a group "<group_id3>" using the GraphApi
Then the HTTP status code of responses on all endpoints should be "500"
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 tries to create a group "([^"]*)" using the GraphApi$/
*
* @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 02dff34

Please sign in to comment.