Skip to content

Commit

Permalink
wip -- fixing sharing tests in ocis-eos
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach committed Aug 14, 2020
1 parent 92423bd commit a10701e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/TestHelpers/OcisHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
*/
class OcisHelper {

private static $withSkeleton = true;

public static function setSkeleton() {
self::$withSkeleton = true;
}

public static function unSetSkeleton() {
self::$withSkeleton = false;
}
/**
* @return bool
*/
Expand All @@ -54,6 +63,25 @@ public static function getDeleteUserDataCommand() {
return (\getenv("DELETE_USER_DATA_CMD"));
}

/**
* @return bool
*/
public static function getDeleteUserShareCommand() {
return (\getenv("DELETE_USER_SHARE_CMD"));
}

/**
* @param string $user
*
* @return void
*/
public static function deleteRevaUserShares() {
$deleteCmd = self::getDeleteUserShareCommand();
if ($deleteCmd !== false) {
\exec($deleteCmd);
}
}

/**
* @param string $user
*
Expand All @@ -65,6 +93,7 @@ public static function deleteRevaUserData($user = "") {
$deleteCmd = \sprintf($deleteCmd, $user[0] . '/' . $user);
// var_dump($deleteCmd);
\exec($deleteCmd);
\exec('docker exec -it ocis rm /var/tmp/ocis-accounts/' . $user);
} else {
self::recurseRmdir(self::getOcisRevaDataRoot() . "/data/" . $user);
}
Expand Down Expand Up @@ -108,6 +137,9 @@ public static function recurseCopy($source, $destination) {
* @throws \Exception
*/
public static function recurseUpload($baseUrl, $source, $userId, $password, $destination = '') {
if (!self::$withSkeleton) {
return;
}
if ($destination !== '') {
$response = WebDavHelper::makeDavRequest(
$baseUrl,
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ public function theseUsersHaveBeenCreatedWithoutSkeletonFiles(TableNode $table)
["config:system:set skeletondirectory --value $path"],
null, null, $baseUrl
);
if (OcisHelper::isTestingOnOcis()) {
OcisHelper::setSkeleton();
}
}
}

Expand Down Expand Up @@ -4136,6 +4139,7 @@ public function afterScenario() {
foreach ($this->getCreatedUsers() as $user) {
OcisHelper::deleteRevaUserData($user["actualUsername"]);
}
OcisHelper::deleteRevaUserShares();
} else {
$this->resetAdminUserAttributes();
}
Expand Down Expand Up @@ -4311,6 +4315,9 @@ public function popSkeletonDirectoryConfig($baseUrl = null) {
["config:system:delete skeletondirectory"],
null, null, $baseUrl
);
if (OcisHelper::isTestingOnOcis()) {
OcisHelper::unSetSkeleton();
}
return $path;
}
}
1 change: 1 addition & 0 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ public function createShare(
$this->ocsApiVersion,
$this->sharingApiVersion
);
var_dump($this->response->getBody()->getContents());
$this->lastShareData = $this->getResponseXml();
if ($shareType === 'public_link' && isset($this->lastShareData->data)) {
$linkName = (string) $this->lastShareData->data[0]->name;
Expand Down

0 comments on commit a10701e

Please sign in to comment.