[tests-only][full-ci] refactoring user creation Given steps from provisioning into GraphContext (#7019)

* refactored the user creation given statement from provisioning to graph api

added getUser steps that covers the steps for user with user light role

* added userlight step tests to check drive information and updated expected failure files

* added usercreation initiation code

* deleted seperate tests for user light role

* remove unnecesary changes

* add user not initialize step

* corrected the testcode

* moved the steps from graph to provisioning file

* fix creating single ldap user

* fix: user check method

* initialize user via graph

* addressing reviews

---------

Co-authored-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Sabin Panta
2023-09-06 09:22:38 +05:45
committed by GitHub
co-authored by Saw-jan
parent 64bfdf24b5
commit 5efc3c51a1
11 changed files with 213 additions and 493 deletions
@@ -724,41 +724,6 @@ class GraphContext implements Context {
return $this->getArrayOfUsersResponded($this->listGroupMembers($group));
}
/**
* creates a user with provided data
* actor: the administrator
*
* @param string $user
* @param string $password
* @param string $email
* @param string $displayName
*
* @return void
* @throws Exception|GuzzleException
*/
public function theAdminHasCreatedUser(
string $user,
string $password,
string $email,
string $displayName
): void {
$response = GraphHelper::createUser(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$this->featureContext->getAdminUsername(),
$this->featureContext->getAdminPassword(),
$user,
$password,
$email,
$displayName
);
if ($response->getStatusCode() !== 200) {
$this->throwHttpException($response, "Could not create user $user");
} else {
$this->featureContext->setResponse($response);
}
}
/**
* @When /^the user "([^"]*)" creates a new user using GraphAPI with the following settings:$/
*
@@ -795,28 +760,6 @@ class GraphContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @Given /^the user "([^"]*)" has created a new user using the Graph API with the following settings:$/
*
* @param string $user
* @param TableNode $table
*
* @return void
* @throws Exception|GuzzleException
*/
public function theUserHasCreatedANewUserUsingGraphapiWithTheFollowingSettings(string $user, TableNode $table): void {
$this->theUserCreatesNewUser(
$user,
$table
);
$rows = $table->getRowsHash();
$response = $this->featureContext->getResponse();
if ($response->getStatusCode() !== 200) {
$this->throwHttpException($response, "Could not create user '$rows[userName]'");
}
}
/**
* adds a user to a group
*