add test to check settings api response

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2025-01-02 17:16:13 +05:45
parent 1f537b57fb
commit 11b5e8ccbc
6 changed files with 348 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ class SettingsContext implements Context {
}
/**
* @When /^user "([^"]*)" tries to get all existing roles$/
* @When /^user "([^"]*)" tries to get all existing roles using the settings API$/
*
* @param string $user
*
@@ -139,6 +139,30 @@ class SettingsContext implements Context {
);
}
/**
* @When user :assigner assigns the role :role to user :assignee using the settings API
*
* @param string $assigner
* @param string $role
* @param string $assignee
*
* @return void
*
* @throws Exception
*/
public function userAssignsTheRoleToUserUsingTheSettingsApi(
string $assigner,
string $role,
string $assignee
): void {
$response = $this->assignRoleToUser(
$assigner,
$this->featureContext->getAttributeOfCreatedUser($assignee, 'id'),
$this->getRoleIdByRoleName($assigner, $role)
);
$this->featureContext->setResponse($response);
}
/**
* @param string $user
* @param string $role
@@ -232,7 +256,7 @@ class SettingsContext implements Context {
}
/**
* @When /^user "([^"]*)" tries to get list of assignment$/
* @When /^user "([^"]*)" tries to get list of assignment using the settings API$/
*
* @param string $user
*
@@ -444,6 +468,22 @@ class SettingsContext implements Context {
);
}
/**
* @When user :user switches the system language to :language using the settings API
*
* @param string $user
* @param string $language
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userSwitchesTheSystemLanguageUsingTheSettingsApi(string $user, string $language): void {
$response = $this->sendRequestToSwitchSystemLanguage($user, $language);
$this->featureContext->setResponse($response);
}
/**
* @param string $user
*
@@ -497,4 +537,20 @@ class SettingsContext implements Context {
);
$this->featureContext->rememberUserAutoSyncSetting($user, false);
}
/**
* @When user :user disables the auto-sync share using the settings API
*
* @param string $user
*
* @return void
*
* @throws Exception
* @throws GuzzleException
*/
public function userDisablesAutoAcceptingUsingSettingsApi(string $user): void {
$response = $this->sendRequestToDisableAutoAccepting($user);
$this->featureContext->setResponse($response);
$this->featureContext->rememberUserAutoSyncSetting($user, false);
}
}