[tests-only][full-ci] forward port user and group search tests (#8240)
* fixing json assertion for addUserToGroup.feature * adding tests for searching groups as a normal user * adding tests for searching user as a normal user * fixing json assertion for removeUserFromGroup.feature * fixing json assertion for listPermissions.feature
This commit is contained in:
@@ -1252,6 +1252,28 @@ class GraphContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :byUser tries to search for user :searchTerm using Graph API
|
||||
* @When user :byUser searches for user :searchTerm using Graph API
|
||||
*
|
||||
* @param string $byUser
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userSearchesForUserUsingGraphApi(string $byUser, string $searchTerm): void {
|
||||
$credentials = $this->getAdminOrUserCredentials($byUser);
|
||||
$response = GraphHelper::searchUser(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$credentials['username'],
|
||||
$credentials['password'],
|
||||
$searchTerm,
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to get all users using the Graph API
|
||||
* @When user :user gets all users using the Graph API
|
||||
@@ -1875,6 +1897,28 @@ class GraphContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user tries to search for group :searchTerm using Graph API
|
||||
* @When user :user searches for group :searchTerm using Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $searchTerm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userSearchesForGroupUsingGraphApi($user, $searchTerm):void {
|
||||
$credentials = $this->getAdminOrUserCredentials($user);
|
||||
$this->featureContext->setResponse(
|
||||
GraphHelper::searchGroup(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$credentials["username"],
|
||||
$credentials["password"],
|
||||
$searchTerm
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the JSON data of the response should (not )?contain the user "([^"]*)" in the item 'value'(?:, the user-details should match)?$/
|
||||
* @Then /^the JSON data of the response should (not )?contain the group "([^"]*)" in the item 'value'(?:, the group-details should match)?$/
|
||||
|
||||
Reference in New Issue
Block a user