Skip to content

Commit

Permalink
change the step definition code for user disable action
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Jul 17, 2023
1 parent 48f4ded commit 170bc41
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
33 changes: 18 additions & 15 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
use PHPUnit\Framework\Assert;
use TestHelpers\GraphHelper;
use TestHelpers\OcsApiHelper;
use TestHelpers\UserHelper;
use TestHelpers\HttpRequestHelper;
Expand Down Expand Up @@ -3825,9 +3826,9 @@ public function theAdministratorDisablesTheFollowingUsersUsingTheProvisioningApi
*/
public function adminHasDisabledUserUsingTheProvisioningApi(?string $user):void {
$user = $this->getActualUsername($user);
$this->disableOrEnableUser($this->getAdminUsername(), $user, 'disable');
$this->theHTTPStatusCodeShouldBeSuccess();
$this->ocsContext->assertOCSResponseIndicatesSuccess();
$response=$this->disableOrEnableUser($this->getAdminUsername(), $user, null, null, null, null, false);
$this->setResponse($response);
$this->thenTheHTTPStatusCodeShouldBe(200);
}

/**
Expand Down Expand Up @@ -5402,20 +5403,22 @@ public function rememberGroupsThatExistAtTheStartOfTheScenario():void {
*
* @return void
*/
public function disableOrEnableUser(string $user, string $otherUser, string $action):void {
public function disableOrEnableUser(string $user, string $otherUser, string $userName = null, string $password = null, string $email = null, string $displayName = null, bool $accountEnabled = true):ResponseInterface {
$actualUser = $this->getActualUsername($user);
$actualPassword = $this->getPasswordForUser($actualUser);
$actualOtherUser = $this->getActualUsername($otherUser);

$fullUrl = $this->getBaseUrl()
. "/ocs/v$this->ocsApiVersion.php/cloud/users/$actualOtherUser/$action";
$this->response = HttpRequestHelper::put(
$fullUrl,
$this->getStepLineRef(),
$actualUser,
$actualPassword
);
$this->pushToLastStatusCodesArrays();
$userId = $this->getAttributeOfCreatedUser($otherUser, 'id');
return GraphHelper::editUser(
$this->getBaseUrl(),
$this->getStepLineRef(),
$actualUser,
$actualPassword,
$userId,
$userName,
$password,
$email,
$displayName,
$accountEnabled
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Feature: share resources with a disabled user
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has been disabled
When user "Alice" shares file "textfile0.txt" with user "Brian" using the sharing API
Then the OCS status code should be "997"
And the HTTP status code should be "401"


Expand All @@ -23,6 +22,4 @@ Feature: share resources with a disabled user
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has been disabled
When user "Alice" shares file "textfile0.txt" with user "Brian" using the sharing API
Then the OCS status code should be "997"
#And the OCS status code should be "401"
And the HTTP status code should be "401"
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Feature: refuse access
Given using <dav-path-version> DAV path
And user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile0.txt"
And the user "Admin" has disabled user "Alice" using the Graph API
And user "Alice" has been disabled
When user "Alice" downloads file "/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "401"
Examples:
Expand Down

0 comments on commit 170bc41

Please sign in to comment.