Merge pull request #4492 from owncloud/reuseCodeFromCodeForFavourites
[tests-only][full-ci]Reuse code from code for `favorites.feature` in ocis
This commit is contained in:
3 files changed
+25
-44
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# The test runner source for API tests
|
# The test runner source for API tests
|
||||||
CORE_COMMITID=d8ed82769fc422c38d6f6bc21253a052eef5e239
|
CORE_COMMITID=b51fb4c01f08763e023aece4f90308e07a7ac73f
|
||||||
CORE_BRANCH=master
|
CORE_BRANCH=master
|
||||||
|
|
||||||
# The test runner source for UI tests
|
# The test runner source for UI tests
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ default:
|
|||||||
- FilesVersionsContext:
|
- FilesVersionsContext:
|
||||||
- OCSContext:
|
- OCSContext:
|
||||||
- PublicWebDavContext:
|
- PublicWebDavContext:
|
||||||
|
- FavoritesContext:
|
||||||
- TrashbinContext:
|
- TrashbinContext:
|
||||||
- WebDavPropertiesContext:
|
- WebDavPropertiesContext:
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ class SpacesContext implements Context {
|
|||||||
*/
|
*/
|
||||||
private WebDavPropertiesContext $webDavPropertiesContext;
|
private WebDavPropertiesContext $webDavPropertiesContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var FavoritesContext
|
||||||
|
*/
|
||||||
|
private FavoritesContext $favoritesContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@@ -264,6 +269,21 @@ class SpacesContext implements Context {
|
|||||||
return $spaces[$spaceName];
|
return $spaces[$spaceName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method sets space id by Space Name
|
||||||
|
* This is currently used to set space id from ocis in core so that we can reuse available resource (code) and avoid duplication
|
||||||
|
*
|
||||||
|
* @param string $user
|
||||||
|
* @param string $spaceName
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws GuzzleException
|
||||||
|
*/
|
||||||
|
public function setSpaceIDByName(string $user, string $spaceName): void {
|
||||||
|
$space = $this->getSpaceByName($user, $spaceName);
|
||||||
|
WebDavHelper::$SPACE_ID_FROM_OCIS = $space['id'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method finds available spaces to the manager user and returns the space by spaceName
|
* The method finds available spaces to the manager user and returns the space by spaceName
|
||||||
*
|
*
|
||||||
@@ -430,6 +450,7 @@ class SpacesContext implements Context {
|
|||||||
$this->ocsContext = $environment->getContext('OCSContext');
|
$this->ocsContext = $environment->getContext('OCSContext');
|
||||||
$this->trashbinContext = $environment->getContext('TrashbinContext');
|
$this->trashbinContext = $environment->getContext('TrashbinContext');
|
||||||
$this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext');
|
$this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext');
|
||||||
|
$this->favoritesContext = $environment->getContext('FavoritesContext');
|
||||||
// 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(), "/");
|
||||||
@@ -618,28 +639,6 @@ class SpacesContext implements Context {
|
|||||||
return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers);
|
return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, $method, $user, $password, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* send proppatch request to url
|
|
||||||
*
|
|
||||||
* @param string $fullUrl
|
|
||||||
* @param string $user
|
|
||||||
* @param string $password
|
|
||||||
* @param string $xRequestId
|
|
||||||
* @param array $headers
|
|
||||||
* @param mixed|null $body
|
|
||||||
* @return ResponseInterface
|
|
||||||
*/
|
|
||||||
public function sendPropPatchRequest(
|
|
||||||
string $fullUrl,
|
|
||||||
string $user,
|
|
||||||
string $password,
|
|
||||||
string $xRequestId = '',
|
|
||||||
array $headers = [],
|
|
||||||
$body
|
|
||||||
): ResponseInterface {
|
|
||||||
return HttpRequestHelper::sendRequest($fullUrl, $xRequestId, 'PROPPATCH', $user, $password, $headers, $body);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" lists all available spaces via the GraphApi$/
|
* @When /^user "([^"]*)" lists all available spaces via the GraphApi$/
|
||||||
* @When /^user "([^"]*)" lists all available spaces via the GraphApi with query "([^"]*)"$/
|
* @When /^user "([^"]*)" lists all available spaces via the GraphApi with query "([^"]*)"$/
|
||||||
@@ -3275,26 +3274,7 @@ class SpacesContext implements Context {
|
|||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userFavoritesElementInSpaceUsingTheWebdavApi(string $user, string $path, string $spaceName): void {
|
public function userFavoritesElementInSpaceUsingTheWebdavApi(string $user, string $path, string $spaceName): void {
|
||||||
$space = $this->getSpaceByName($user, $spaceName);
|
$this->setSpaceIDByName($user, $spaceName);
|
||||||
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($path, "/");
|
$this->favoritesContext->userFavoritesElement($user, $path);
|
||||||
$body = '<?xml version="1.0"?>
|
|
||||||
<d:propertyupdate xmlns:d="DAV:"
|
|
||||||
xmlns:oc="http://owncloud.org/ns">
|
|
||||||
<d:set>
|
|
||||||
<d:prop>
|
|
||||||
<oc:favorite xmlns:oc="http://owncloud.org/ns">1</oc:favorite>
|
|
||||||
</d:prop>
|
|
||||||
</d:set>
|
|
||||||
</d:propertyupdate>';
|
|
||||||
$this->featureContext->setResponse(
|
|
||||||
$this->sendProppatchRequest(
|
|
||||||
$fullUrl,
|
|
||||||
$user,
|
|
||||||
$this->featureContext->getPasswordForUser($user),
|
|
||||||
$this->featureContext->getStepLineRef(),
|
|
||||||
[],
|
|
||||||
$body
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user