Removed method isTestingOnOcis, and refactored code

This commit is contained in:
Prarup Gurung
2023-03-13 12:08:42 +05:45
parent fd64718a7c
commit 06169628af
5 changed files with 12 additions and 63 deletions
@@ -720,16 +720,15 @@ trait Provisioning {
}
if (isset($setting["email"])) {
$entry['mail'] = $setting["email"];
} elseif (OcisHelper::isTestingOnOcis()) {
} else {
$entry['mail'] = $userId . '@owncloud.com';
}
$entry['gidNumber'] = 5000;
$entry['uidNumber'] = $uidNumber;
if (OcisHelper::isTestingOnOcis()) {
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
}
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
if (OcisHelper::isTestingParallelDeployment()) {
$entry['ownCloudSelector'] = $this->getOCSelector();
}
@@ -765,10 +764,9 @@ trait Provisioning {
$entry['objectclass'][] = 'groupOfNames';
$entry['member'] = "";
}
if (OcisHelper::isTestingOnOcis()) {
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
}
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
$this->ldap->add($newDN, $entry);
$this->ldapCreatedGroups[] = $group;
}
@@ -1108,12 +1106,6 @@ trait Provisioning {
if ($skeleton) {
$this->manuallyAddSkeletonFiles($usersAttributes);
}
if ($initialize && ($this->isEmptySkeleton() || !OcisHelper::isTestingOnOcis())) {
// We need to initialize each user using the individual authentication of each user.
// That is not possible in Guzzle6 batch mode. So we do it with normal requests in serial.
$this->initializeUsers($users);
}
}
/**
@@ -2991,30 +2983,6 @@ trait Provisioning {
$this->lastUploadTime = \time();
}
/**
* Touch an API end-point for each user so that their file-system gets setup
*
* @param array $users
*
* @return void
* @throws Exception
*/
public function initializeUsers(array $users):void {
$url = "/cloud/users/%s";
foreach ($users as $user) {
$response = OcsApiHelper::sendRequest(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
'GET',
\sprintf($url, $user),
$this->getStepLineRef()
);
$this->setResponse($response);
$this->theHTTPStatusCodeShouldBe(200);
}
}
/**
* adds a user to the list of users that were created during test runs
* makes it possible to use this list in other test steps
@@ -3292,13 +3260,11 @@ trait Provisioning {
} elseif (OcisHelper::isTestingWithGraphApi()) {
$requestingUser = $this->getAdminUsername();
$requestingPassword = $this->getAdminPassword();
} elseif (OcisHelper::isTestingOnOcis()) {
} else {
$requestingUser = 'moss';
$requestingPassword = 'vista';
} else {
$requestingUser = $this->getActualUsername($user);
$requestingPassword = $this->getPasswordForUser($requestingUser);
}
$path = (OcisHelper::isTestingWithGraphApi())
? "/graph/v1.0"
: "/ocs/v2.php/cloud";