tests: Adjust acceptance test for recent graph API changes

Searching for federated users requires a $filter now.
This commit is contained in:
Ralf Haferkamp
2024-08-13 12:09:09 +02:00
parent 99df9bd3bb
commit 3288602c50
3 changed files with 54 additions and 7 deletions

View File

@@ -306,6 +306,32 @@ class GraphHelper {
);
}
/**
* @param string $baseUrl
* @param string $xRequestId
* @param string $adminUser
* @param string $adminPassword
* @param string $searchTerm
*
* @return ResponseInterface
*/
public static function searchFederatedUser(
string $baseUrl,
string $xRequestId,
string $adminUser,
string $adminPassword,
string $searchTerm
): ResponseInterface {
$url = self::getFullUrl($baseUrl, "users?\$filter=userType eq 'Federated'&\$search=$searchTerm");
return HttpRequestHelper::get(
$url,
$xRequestId,
$adminUser,
$adminPassword,
self::getRequestHeaders()
);
}
/**
* @param string $baseUrl
* @param string $xRequestId

View File

@@ -18,7 +18,7 @@ Feature: search federation users
And "Alice" has created the federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
When user "Brian" searches for user "ali" using Graph API
When user "Brian" searches for federated user "ali" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -53,7 +53,7 @@ Feature: search federation users
}
"""
And using server "LOCAL"
When user "Alice" searches for user "bri" using Graph API
When user "Alice" searches for federated user "bri" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -94,7 +94,7 @@ Feature: search federation users
And "Alice" has created the federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
When user "Brian" searches for user "%22alice@example.org%22" using Graph API
When user "Brian" searches for federated user "%22alice@example.org%22" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -129,7 +129,7 @@ Feature: search federation users
}
"""
And using server "LOCAL"
When user "Alice" searches for user "%22brian@example.org%22" using Graph API
When user "Alice" searches for federated user "%22brian@example.org%22" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -170,7 +170,7 @@ Feature: search federation users
And "Alice" has created the federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
When user "Brian" searches for user "%22carol@example.org%22" using Graph API
When user "Brian" searches for federated user "%22carol@example.org%22" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -189,7 +189,7 @@ Feature: search federation users
}
"""
And using server "LOCAL"
When user "Carol" searches for user "bria" using Graph API
When user "Carol" searches for federated user "bria" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -325,4 +325,4 @@ Feature: search federation users
"""
# TODO try to find federation users after deleting federated conection
# TODO try to find federation users after deleting federated conection

View File

@@ -1253,6 +1253,27 @@ class GraphContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @When user :byUser searches for federated user :searchTerm using Graph API
*
* @param string $byUser
* @param string $searchTerm
*
* @return void
* @throws GuzzleException
*/
public function userSearchesForFederatedUserUsingGraphApi(string $byUser, string $searchTerm): void {
$credentials = $this->getAdminOrUserCredentials($byUser);
$response = GraphHelper::searchFederatedUser(
$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