Skip to content

Commit

Permalink
updated expected failure file
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Aug 17, 2023
1 parent bb588e7 commit ce715e4
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiGraph/getGroup.feature:382](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L382)
- [apiGraph/getGroup.feature:383](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L383)

#### [Changing user with an uppercase name gives 404 error](https://github.com/owncloud/ocis/issues/5763)
#### [Changing user with an uppercase name gives 404 error](https://github.com/owncloud/ocis/issues/7044)

- [apiGraph/editUser.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/editUser.feature#L67)

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiGraph/deleteUser.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: delete user

Scenario Outline: admin user deletes a user
Given the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And the administrator has created a new user with the following attributes:
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | <userName> |
| displayName | <displayName> |
| email | <email> |
Expand Down
47 changes: 31 additions & 16 deletions tests/acceptance/features/apiGraph/editUser.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@api
Feature: edit user
As an admin
I want to be able to edit user information
Expand All @@ -10,7 +9,7 @@ Feature: edit user
Background:
Given user "Alice" has been created with default attributes and without skeleton files
And the administrator has assigned the role "Admin" to user "Alice" using the Graph API
And the administrator has created a new user with the following attributes:
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | Brian |
| displayName | Brian Murphy |
| email | brian@example.com |
Expand Down Expand Up @@ -43,7 +42,7 @@ Feature: edit user
| empty mail | | 400 | brian@example.com |
| change to a invalid email | invalidEmail | 400 | brian@example.com |

@issue-5763
@issue-7044
Scenario Outline: admin user can edit another user's name
Given user "Carol" has been created with default attributes and without skeleton files
When the user "Alice" changes the user name of user "Carol" to "<userName>" using the Graph API
Expand Down Expand Up @@ -72,11 +71,15 @@ Feature: edit user


Scenario: admin user changes the name of a user to the name of an existing disabled user
Given user "Carol" has been created with default attributes and without skeleton files
Given the user "Alice" has created a new user using the Graph API with the following settings:
| userName | sam |
| displayName | sam |
| email | sam@example.com |
| password | 1234 |
And the user "Alice" has disabled user "Brian" using the Graph API
When the user "Alice" changes the user name of user "Carol" to "Brian" using the Graph API
When the user "Alice" changes the user name of user "sam" to "Brian" using the Graph API
Then the HTTP status code should be "409"
And the user information of "Carol" should match this JSON schema
And the user information of "sam" should match this JSON schema
"""
{
"type": "object",
Expand All @@ -86,17 +89,21 @@ Feature: edit user
"properties": {
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]
"enum": ["sam"]
}
}
}
"""

@issue-7044

Scenario: admin user changes the name of a user to the name of a previously deleted user
Given user "Carol" has been created with default attributes and without skeleton files
And the user "Alice" has deleted a user "Carol" using the Graph API
When the user "Alice" changes the user name of user "Brian" to "Carol" using the Graph API
Given the user "Alice" has created a new user using the Graph API with the following settings:
| userName | sam |
| displayName | sam |
| email | sam@example.com |
| password | 1234 |
And the user "Alice" has deleted a user "sam" using the Graph API
When the user "Alice" changes the user name of user "Brian" to "sam" using the Graph API
Then the HTTP status code should be "200"
And the user information of "sam" should match this JSON schema
"""
Expand All @@ -108,7 +115,7 @@ Feature: edit user
"properties": {
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]
"enum": ["sam"]
}
}
}
Expand Down Expand Up @@ -143,7 +150,11 @@ Feature: edit user

Scenario Outline: normal user should not be able to edit another user's email
Given the administrator has assigned the role "<userRole>" to user "Brian" using the Graph API
And user "Carol" has been created with default attributes and without skeleton files
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | Carol |
| displayName | Carol King |
| email | carol@example.org |
| password | 1234 |
And the administrator has assigned the role "<role>" to user "Carol" using the Graph API
When the user "Brian" tries to change the email of user "Carol" to "newemail@example.com" using the Graph API
Then the HTTP status code should be "401"
Expand Down Expand Up @@ -232,7 +243,11 @@ Feature: edit user

Scenario Outline: normal user should not be able to edit another user's display name
Given the administrator has assigned the role "<userRole>" to user "Brian" using the Graph API
And user "Carol" has been created with default attributes and without skeleton files
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | Carol |
| displayName | Carol King |
| email | carol@example.com |
| password | 1234 |
And the administrator has assigned the role "<role>" to user "Carol" using the Graph API
When the user "Brian" tries to change the display name of user "Carol" to "Alice Hansen" using the Graph API
Then the HTTP status code should be "401"
Expand Down Expand Up @@ -276,7 +291,7 @@ Feature: edit user

Scenario Outline: normal user should not be able to reset the password of another user
Given the administrator has assigned the role "<userRole>" to user "Brian" using the Graph API
And the administrator has created a new user with the following attributes:
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | Carol |
| displayName | Carol King |
| email | carol@example.com |
Expand All @@ -303,7 +318,7 @@ Feature: edit user
Scenario Outline: normal user should not be able to reset the password of another user light user
Given the administrator has assigned the role "<userRole>" to user "Brian" using the Graph API
And user "Alice" has uploaded file with content "for guest" to "/forguest.txt"
And the administrator has created a new user with the following attributes:
And the user "Alice" has created a new user using the Graph API with the following settings:
| userName | Carol |
| displayName | Carol King |
| email | carol@example.com |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function theUserGetsCapabilitiesCheckResponse():void {

/**
* @return string
* @throws Exception
* @throws Exception|GuzzleException
*/
public function getAdminUsernameForCapabilitiesCheck():string {
if (\TestHelpers\OcisHelper::isTestingOnReva()) {
Expand All @@ -190,7 +190,7 @@ public function getAdminUsernameForCapabilitiesCheck():string {
$adminUsername = "PseudoAdminForRevaTest";
$createdUsers = $this->featureContext->getCreatedUsers();
if (!\array_key_exists($adminUsername, $createdUsers)) {
$this->featureContext->userHasBeenCreated($adminUsername);
$this->featureContext->userHasBeenCreated(["userName" => $adminUsername]);
}
} else {
$adminUsername = $this->featureContext->getAdminUsername();
Expand Down
14 changes: 7 additions & 7 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,12 @@ public function theAdminHasRetrievedMembersListOfGroupUsingTheGraphApi(string $g
* @param string $user
*
* @return void
* @throws Exception
* @throws Exception|GuzzleException
*/
public function userHasBeenCreatedWithDefaultAttributes(
string $user
):void {
$this->featureContext->userHasBeenCreated($user);
$this->featureContext->userHasBeenCreated(["userName" => $user]);
}

/**
Expand All @@ -754,19 +754,19 @@ public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeleton

/**
* @Given the administrator has created a new user with the following attributes:
* @Given the user :byUser has created a new user using the Graph API with the following settings:
*
* @param string $byUser
* @param TableNode $table
*
* @return void
* @throws Exception|GuzzleException
*/
public function theAdministratorHasCreatedANewUserWithFollowingAttributes(TableNode $table): void {
public function theAdministratorHasCreatedANewUserWithFollowingAttributes(string $byUser, TableNode $table): void {
$rows = $table->getRowsHash();
$this->featureContext->userHasBeenCreated(
$rows["userName"],
$rows["password"],
$rows["displayName"],
$rows["email"]
$rows,
$byUser
);
}

Expand Down
23 changes: 13 additions & 10 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -2566,21 +2566,23 @@ public function rememberThatUserIsNotExpectedToExist(string $user):void {
/**
* creates a single user
*
* @param string $user
* @param string|null $password if null, then select a password
* @param string|null $displayName
* @param string|null $email
* @param array $userData
* @param string|null $byUser
*
* @return void
* @throws Exception|GuzzleException
*/
public function userHasBeenCreated(
string $user,
string $password = null,
string $displayName = null,
string $email = null
array $userData,
string $byUser = null
):void {
$userId = null;

$user = $userData["userName"];
$displayName = $userData["displayName"] ?? null;
$email = $userData["email"] ?? null;
$password = $userData["password"] ?? null;

if ($password === null) {
$password = $this->getPasswordForUser($user);
}
Expand Down Expand Up @@ -2618,11 +2620,12 @@ public function userHasBeenCreated(
);
}
} else {
$reqUser = $byUser ? $this->getActualUsername($byUser) : $this->getAdminUsername();
$response = GraphHelper::createUser(
$this->getBaseUrl(),
$this->getStepLineRef(),
$this->getAdminUsername(),
$this->getAdminPassword(),
$reqUser,
$this->getPasswordForUser($reqUser),
$user,
$password,
$email,
Expand Down

0 comments on commit ce715e4

Please sign in to comment.