mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-05 13:07:12 -04:00
Merge pull request #9575 from owncloud/ocis-cli-test-password-reset-non-user
[tests-only][full-ci] added cli test for changing password of non-existing user
This commit is contained in:
@@ -68,21 +68,24 @@ class CliContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator resets the password of user :user to :password using the CLI
|
||||
* @When /^the administrator resets the password of (non-existing|existing) user "([^"]*)" to "([^"]*)" using the CLI$/
|
||||
*
|
||||
* @param string $status
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $user, string $password): void {
|
||||
public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $status, string $user, string $password): void {
|
||||
$command = "idm resetpassword -u $user";
|
||||
$body = [
|
||||
"command" => $command,
|
||||
"inputs" => [$password, $password]
|
||||
];
|
||||
|
||||
$this->featureContext->setResponse(CliHelper::runCommand($body));
|
||||
if ($status === "non-existing") {
|
||||
return;
|
||||
}
|
||||
$this->featureContext->updateUserPassword($user, $password);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,17 @@ Feature: reset user password via CLI command
|
||||
| displayName | Alice Hansen |
|
||||
| password | %alt1% |
|
||||
And the administrator has stopped the server
|
||||
When the administrator resets the password of user "Alice" to "newpass" using the CLI
|
||||
When the administrator resets the password of existing user "Alice" to "newpass" using the CLI
|
||||
Then the command should be successful
|
||||
And the command output should contain "Password for user 'uid=Alice,ou=users,o=libregraph-idm' updated."
|
||||
But the command output should not contain "Failed to update user password: entry does not exist"
|
||||
And the administrator has started the server
|
||||
And user "Alice" should be able to create folder "newFolder" using password "newpass"
|
||||
But user "Alice" should not be able to create folder "anotherFolder" using password "%alt1%"
|
||||
|
||||
|
||||
Scenario: try to reset password of non-existing user
|
||||
Given the administrator has stopped the server
|
||||
When the administrator resets the password of non-existing user "Alice" to "newpass" using the CLI
|
||||
Then the command should be successful
|
||||
But the command output should contain "Failed to update user password: entry does not exist"
|
||||
|
||||
Reference in New Issue
Block a user