[full-ci] getting personal space by userId instead of userName (#1553)

* getting personal space by userId instead of userName

* delete geting userId via api call

* add new created user id to user list

* fix after review
This commit is contained in:
Viktor Scharf
2025-09-26 10:51:41 +02:00
committed by GitHub
parent e7b7ceafd5
commit 723340dba6
13 changed files with 126 additions and 83 deletions
+4 -28
View File
@@ -2333,9 +2333,9 @@ class FeatureContext extends BehatVariablesContext {
[
"code" => "%user_id%",
"function" => [
$this, "getUserIdByUserName"
$this, "getAttributeOfCreatedUser"
],
"parameter" => [$userName]
"parameter" => [$userName, 'id']
],
[
"code" => "%group_id%",
@@ -2511,8 +2511,8 @@ class FeatureContext extends BehatVariablesContext {
[
"code" => "%user_id%",
"function" =>
[$this, "getUserIdByUserName"],
"parameter" => [$userName]
[$this, "getAttributeOfCreatedUser"],
"parameter" => [$userName, 'id']
],
[
"code" => "%group_id%",
@@ -2868,30 +2868,6 @@ class FeatureContext extends BehatVariablesContext {
return $body;
}
/**
* The method returns userId
*
* @param string $userName
*
* @return string
* @throws Exception|GuzzleException
*/
public function getUserIdByUserName(string $userName): string {
$response = GraphHelper::getUser(
$this->getBaseUrl(),
$this->getStepLineRef(),
$this->getAdminUsername(),
$this->getAdminPassword(),
$userName
);
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
if (isset($data["id"])) {
return $data["id"];
} else {
throw new Exception(__METHOD__ . " accounts-list is empty");
}
}
/**
* The method returns groupId
*