add Graph API tests for editign group display name (#5101)

This commit is contained in:
Sawjan Gurung
2022-11-24 15:13:27 +05:45
committed by GitHub
parent b7945336a2
commit 13452e48cb
3 changed files with 70 additions and 0 deletions

View File

@@ -60,3 +60,11 @@ The expected failures in this file are from features in the owncloud/ocis repo.
#### [Share lists deleted user as 'user'](https://github.com/owncloud/ocis/issues/903)
- [apiGraph/deleteGroup.feature:62](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/deleteGroup.feature#L62)
#### [Updating group displayName request seems OK but group is not being renamed](https://github.com/owncloud/ocis/issues/5099)
- [apiGraph/editGroup.feature:20](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L20)
- [apiGraph/editGroup.feature:21](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L21)
- [apiGraph/editGroup.feature:22](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L22)
- [apiGraph/editGroup.feature:23](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L23)
- [apiGraph/editGroup.feature:24](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L24)
- [apiGraph/editGroup.feature:25](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editGroup.feature#L25)

View File

@@ -0,0 +1,25 @@
@api @skipOnOcV10
Feature: edit group name
As an admin
I want to be able to edit group name
So that I can manage group name
Background:
Given user "Alice" has been created with default attributes and without skeleton files
And the administrator has given "Alice" the role "Admin" using the settings api
@issue-5099
Scenario Outline: admin user renames a group
Given group "<old_group>" has been created
When user "Alice" renames group "<old_group>" to "<new_group>" using the Graph API
Then the HTTP status code should be "204"
And group "<old_group>" should not exist
And group "<new_group>" should exist
Examples:
| old_group | new_group |
| grp1 | grp101 |
| grp1 | España§àôœ |
| grp1 | |
| grp1 | $x<=>[y*z^2]! |
| grp1 | staff?group |
| grp1 | 50%pass |

View File

@@ -889,4 +889,41 @@ class GraphContext implements Context {
);
}
}
/**
* rename group name
*
* @param string $oldGroup
* @param string $newGroup
* @param string $user
*
* @return ResponseInterface
* @throws GuzzleException
*/
public function renameGroup(string $oldGroup, string $newGroup, ?string $user = null): ResponseInterface {
$credentials = $this->getAdminOrUserCredentials($user);
$groupId = $this->featureContext->getAttributeOfCreatedGroup($oldGroup, "id");
return GraphHelper::updateGroup(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$credentials['username'],
$credentials['password'],
$groupId,
$newGroup
);
}
/**
* @When user :user renames group :oldGroup to :newGroup using the Graph API
*
* @param string $user
* @param string $oldGroup
* @param string $newGroup
*
* @return void
*/
public function userRenamesGroupUsingTheGraphApi(string $user, string $oldGroup, string $newGroup): void {
$this->featureContext->setResponse($this->renameGroup($oldGroup, $newGroup, $user));
}
}