mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
[test-only] add test to filter or (#5771)
* add test to filter or * lint
This commit is contained in:
@@ -1151,6 +1151,35 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $firstGroup
|
||||
* @param string $secondGroup
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getUsersFromOneOrOtherGroup(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $firstGroup,
|
||||
string $secondGroup
|
||||
): ResponseInterface {
|
||||
$url = self::getFullUrl($baseUrl, 'users' . '?$filter=memberOf/any(m:m/id ' . "eq '$firstGroup') " . "or memberOf/any(m:m/id eq '$secondGroup')");
|
||||
return HttpRequestHelper::get(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
|
||||
@@ -135,6 +135,26 @@ Feature: get users
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
|
||||
|
||||
@skipOnStable2.0
|
||||
Scenario: admin user gets all users of certain groups
|
||||
Given user "Carol" has been created with default attributes and without skeleton files
|
||||
And group "tea-lover" has been created
|
||||
And group "coffee-lover" has been created
|
||||
And group "wine-lover" has been created
|
||||
And user "Alice" has been added to group "tea-lover"
|
||||
And user "Brian" has been added to group "coffee-lover"
|
||||
And user "Carol" has been added to group "wine-lover"
|
||||
When the user "Alice" gets all users from that are members in the group "tea-lover" or the group "coffee-lover" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the API response should contain following users with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Alice Hansen | %uuid_v4% | alice@example.org | Alice | true |
|
||||
| Brian Murphy | %uuid_v4% | brian@example.org | Brian | true |
|
||||
But the API response should not contain following user with the information:
|
||||
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
|
||||
| Carol King | %uuid_v4% | carol@example.org | Carol | false |
|
||||
|
||||
|
||||
Scenario Outline: non admin user tries to get users of certain groups
|
||||
Given the administrator has given "Brian" the role "<role>" using the settings api
|
||||
And group "tea-lover" has been created
|
||||
|
||||
@@ -1890,6 +1890,28 @@ class GraphContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the user :user gets all users from that are members in the group :firstGroup or the group :secondGroup using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $firstGroup
|
||||
* @param string $secondGroup
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userGetsAllUsersOfFirstGroupOderSecondGroupUsingTheGraphApi(string $user, string $firstGroup, string $secondGroup) {
|
||||
$response = GraphHelper::getUsersFromOneOrOtherGroup(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$firstGroup,
|
||||
$secondGroup
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get roleId by role name
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user