Merge pull request #4536 from owncloud/reuseCodeChecksum
[tests-only][full-ci]Reuse code from core
This commit is contained in:
@@ -70,6 +70,11 @@ class SpacesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
private WebDavLockingContext $webDavLockingContext;
|
private WebDavLockingContext $webDavLockingContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ChecksumContext
|
||||||
|
*/
|
||||||
|
private ChecksumContext $checksumContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@@ -456,6 +461,7 @@ class SpacesContext implements Context {
|
|||||||
$this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext');
|
$this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext');
|
||||||
$this->favoritesContext = $environment->getContext('FavoritesContext');
|
$this->favoritesContext = $environment->getContext('FavoritesContext');
|
||||||
$this->webDavLockingContext = $environment->getContext('WebDavLockingContext');
|
$this->webDavLockingContext = $environment->getContext('WebDavLockingContext');
|
||||||
|
$this->checksumContext = $environment->getContext('ChecksumContext');
|
||||||
// Run the BeforeScenario function in OCSContext to set it up correctly
|
// Run the BeforeScenario function in OCSContext to set it up correctly
|
||||||
$this->ocsContext->before($scope);
|
$this->ocsContext->before($scope);
|
||||||
$this->baseUrl = \trim($this->featureContext->getBaseUrl(), "/");
|
$this->baseUrl = \trim($this->featureContext->getBaseUrl(), "/");
|
||||||
@@ -2702,25 +2708,8 @@ class SpacesContext implements Context {
|
|||||||
string $path,
|
string $path,
|
||||||
string $spaceName
|
string $spaceName
|
||||||
): void {
|
): void {
|
||||||
$space = $this->getSpaceByName($user, $spaceName);
|
$this->setSpaceIDByName($user, $spaceName);
|
||||||
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($path, "/");
|
$this->checksumContext->userRequestsTheChecksumOfViaPropfind($user, $path);
|
||||||
$body = '<?xml version="1.0"?>
|
|
||||||
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
|
|
||||||
<d:prop>
|
|
||||||
<oc:checksums />
|
|
||||||
</d:prop>
|
|
||||||
</d:propfind>';
|
|
||||||
|
|
||||||
$this->featureContext->setResponse(
|
|
||||||
$this->sendPropfindRequestToUrl(
|
|
||||||
$fullUrl,
|
|
||||||
$user,
|
|
||||||
$this->featureContext->getPasswordForUser($user),
|
|
||||||
$this->featureContext->getStepLineRef(),
|
|
||||||
[],
|
|
||||||
$body
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2729,7 +2718,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $checksum
|
* @param string $checksum
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param string $path
|
* @param string $destination
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -2739,22 +2728,11 @@ class SpacesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $checksum,
|
string $checksum,
|
||||||
string $content,
|
string $content,
|
||||||
string $path,
|
string $destination,
|
||||||
string $spaceName
|
string $spaceName
|
||||||
): void {
|
): void {
|
||||||
$space = $this->getSpaceByName($user, $spaceName);
|
$this->setSpaceIDByName($user, $spaceName);
|
||||||
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($path, "/");
|
$this->featureContext->userUploadsAFileWithChecksumAndContentTo($user, $checksum, $content, $destination);
|
||||||
|
|
||||||
$this->featureContext->setResponse(
|
|
||||||
$this->sendPutRequestToUrl(
|
|
||||||
$fullUrl,
|
|
||||||
$user,
|
|
||||||
$this->featureContext->getPasswordForUser($user),
|
|
||||||
"",
|
|
||||||
['OC-Checksum' => $checksum],
|
|
||||||
$content
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user