[tests-only][full-ci] adding user quota using graph api instead of Provisioning api (#7000)
* refactored getQuota scenario * deleted quota step inside provisioning file * updating feature file of quota as per graphapi * updated expected failures file * updated expected failures file * removed issue tag
This commit is contained in:
@@ -1937,122 +1937,6 @@ trait Provisioning {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator changes the quota of user "([^"]*)" to "([^"]*)" using the provisioning API$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function adminChangesTheQuotaOfUserUsingTheProvisioningApi(
|
||||
string $user,
|
||||
string $quota
|
||||
):void {
|
||||
$result = UserHelper::editUser(
|
||||
$this->getBaseUrl(),
|
||||
$this->getActualUsername($user),
|
||||
'quota',
|
||||
$quota,
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
$this->getStepLineRef(),
|
||||
$this->ocsApiVersion
|
||||
);
|
||||
$this->response = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^the administrator has (?:changed|set) the quota of user "([^"]*)" to "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function adminHasChangedTheQuotaOfUserTo(
|
||||
string $user,
|
||||
string $quota
|
||||
):void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$this->adminChangesTheQuotaOfUserUsingTheProvisioningApi(
|
||||
$user,
|
||||
$quota
|
||||
);
|
||||
$this->theHTTPStatusCodeShouldBe(
|
||||
200,
|
||||
"could not change quota of user $user"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $requestingUser
|
||||
* @param string $targetUser
|
||||
* @param string $quota
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function userChangeQuotaOfUserUsingProvisioningApi(
|
||||
string $requestingUser,
|
||||
string $targetUser,
|
||||
string $quota
|
||||
):ResponseInterface {
|
||||
return UserHelper::editUser(
|
||||
$this->getBaseUrl(),
|
||||
$this->getActualUsername($targetUser),
|
||||
'quota',
|
||||
$quota,
|
||||
$this->getActualUsername($requestingUser),
|
||||
$this->getPasswordForUser($requestingUser),
|
||||
$this->getStepLineRef(),
|
||||
$this->ocsApiVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" changes the quota of user "([^"]*)" to "([^"]*)" using the provisioning API$/
|
||||
*
|
||||
* @param string $requestingUser
|
||||
* @param string $targetUser
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userChangesTheQuotaOfUserUsingTheProvisioningApi(
|
||||
string $requestingUser,
|
||||
string $targetUser,
|
||||
string $quota
|
||||
):void {
|
||||
$this->response = $this->userChangeQuotaOfUserUsingProvisioningApi(
|
||||
$requestingUser,
|
||||
$targetUser,
|
||||
$quota
|
||||
);
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has changed the quota of user "([^"]*)" to "([^"]*)"$/
|
||||
*
|
||||
* @param string $requestingUser
|
||||
* @param string $targetUser
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userHasChangedTheQuotaOfUserUsingTheProvisioningApi(
|
||||
string $requestingUser,
|
||||
string $targetUser,
|
||||
string $quota
|
||||
):void {
|
||||
$response = $this->userChangeQuotaOfUserUsingProvisioningApi(
|
||||
$requestingUser,
|
||||
$targetUser,
|
||||
$quota
|
||||
);
|
||||
$this->theHTTPStatusCodeShouldBeBetween(200, 299, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
*
|
||||
@@ -4450,68 +4334,6 @@ trait Provisioning {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator sets the quota of user :user to :quota using the provisioning API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function adminSetsUserQuotaToUsingTheProvisioningApi(string $user, string $quota):void {
|
||||
$user = $this->getActualUsername($user);
|
||||
$body
|
||||
= [
|
||||
'key' => 'quota',
|
||||
'value' => $quota,
|
||||
];
|
||||
|
||||
$this->response = OcsApiHelper::sendRequest(
|
||||
$this->getBaseUrl(),
|
||||
$this->getAdminUsername(),
|
||||
$this->getAdminPassword(),
|
||||
"PUT",
|
||||
"/cloud/users/$user",
|
||||
$this->getStepLineRef(),
|
||||
$body
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the quota of user :user has been set to :quota
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $quota
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theQuotaOfUserHasBeenSetTo(string $user, string $quota):void {
|
||||
$this->adminSetsUserQuotaToUsingTheProvisioningApi($user, $quota);
|
||||
$this->theHTTPStatusCodeShouldBe(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the administrator gives unlimited quota to user :user using the provisioning API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function adminGivesUnlimitedQuotaToUserUsingTheProvisioningApi(string $user):void {
|
||||
$this->adminSetsUserQuotaToUsingTheProvisioningApi($user, 'none');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has been given unlimited quota
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userHasBeenGivenUnlimitedQuota(string $user):void {
|
||||
$this->theQuotaOfUserHasBeenSetTo($user, 'none');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the user attributes returned by the API should include$/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user