Adjust acceptance test code
This commit is contained in:
1 parent
2586682ae0
commit
c796f01396
7 files changed
+59
-102
No files matched your search
@@ -13,7 +13,7 @@ default:
|
|||||||
ldapGroupsOU: TestGroups
|
ldapGroupsOU: TestGroups
|
||||||
ldapInitialUserFilePath: /../../config/ldap-users.ldif
|
ldapInitialUserFilePath: /../../config/ldap-users.ldif
|
||||||
contexts:
|
contexts:
|
||||||
- RevaContext:
|
- GraphContext:
|
||||||
- OccContext:
|
- OccContext:
|
||||||
- FeatureContext: &common_feature_context_params
|
- FeatureContext: &common_feature_context_params
|
||||||
baseUrl: http://localhost:8080
|
baseUrl: http://localhost:8080
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Feature: Preview file in project space
|
|||||||
|
|
||||||
|
|
||||||
Scenario Outline: An user can preview image files in the project space
|
Scenario Outline: An user can preview image files in the project space
|
||||||
Given user "Alice" has uploaded a file "<entity>" via TUS inside of the space "previews of the files" using WebDAV API
|
Given user "Alice" has uploaded a file "<entity>" via TUS inside of the space "previews of the files" using the WebDAV API
|
||||||
When user "Alice" downloads the preview of "<entity>" of the space "previews of the files" with width "<width>" and height "<height>" using the WebDAV API
|
When user "Alice" downloads the preview of "<entity>" of the space "previews of the files" with width "<width>" and height "<height>" using the WebDAV API
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
Examples:
|
Examples:
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
use Behat\Behat\Context\Context;
|
use Behat\Behat\Context\Context;
|
||||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||||
use Behat\Gherkin\Node\TableNode;
|
use Behat\Gherkin\Node\TableNode;
|
||||||
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use TestHelpers\HttpRequestHelper;
|
use TestHelpers\HttpRequestHelper;
|
||||||
use TestHelpers\SetupHelper;
|
use TestHelpers\SetupHelper;
|
||||||
use wapmorgan\UnifiedArchive\UnifiedArchive;
|
use wapmorgan\UnifiedArchive\UnifiedArchive;
|
||||||
@@ -101,7 +102,7 @@ class ArchiverContext implements Context {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
* @throws GuzzleException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function userDownloadsTheArchive(
|
public function userDownloadsTheArchive(
|
||||||
@@ -142,7 +143,7 @@ class ArchiverContext implements Context {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
* @throws GuzzleException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function userDownloadsTheArchiveOfItemOfUser(
|
public function userDownloadsTheArchiveOfItemOfUser(
|
||||||
@@ -172,7 +173,7 @@ class ArchiverContext implements Context {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
* @throws GuzzleException|Exception
|
||||||
*/
|
*/
|
||||||
public function userDownloadsTheArchiveOfTheseItems(
|
public function userDownloadsTheArchiveOfTheseItems(
|
||||||
string $user,
|
string $user,
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ class GraphContext implements Context {
|
|||||||
* @param string $displayName
|
* @param string $displayName
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function theAdminHasCreatedUser(
|
public function theAdminHasCreatedUser(
|
||||||
string $user,
|
string $user,
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
<?php declare(strict_types=1);
|
|
||||||
/**
|
|
||||||
* ownCloud
|
|
||||||
*
|
|
||||||
* @author Phil Davis <phil@jankaritech.com>
|
|
||||||
* @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
|
|
||||||
*
|
|
||||||
* This code is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License,
|
|
||||||
* as published by the Free Software Foundation;
|
|
||||||
* either version 3 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Behat\Behat\Context\Context;
|
|
||||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
|
||||||
use TestHelpers\AppConfigHelper;
|
|
||||||
use TestHelpers\SetupHelper;
|
|
||||||
|
|
||||||
require_once 'bootstrap.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Context for Reva specific steps
|
|
||||||
*/
|
|
||||||
class RevaContext implements Context {
|
|
||||||
/**
|
|
||||||
* @var FeatureContext
|
|
||||||
*/
|
|
||||||
private FeatureContext $featureContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BeforeScenario
|
|
||||||
*
|
|
||||||
* @param BeforeScenarioScope $scope
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function setUpScenario(BeforeScenarioScope $scope): void {
|
|
||||||
// Get the environment
|
|
||||||
$environment = $scope->getEnvironment();
|
|
||||||
// Get all the contexts you need in this context
|
|
||||||
$this->featureContext = $environment->getContext('FeatureContext');
|
|
||||||
SetupHelper::init(
|
|
||||||
$this->featureContext->getAdminUsername(),
|
|
||||||
$this->featureContext->getAdminPassword(),
|
|
||||||
$this->featureContext->getBaseUrl(),
|
|
||||||
$this->featureContext->getOcPath()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -69,12 +69,12 @@ class SpacesContext implements Context {
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $ocsApiUrl = '/ocs/v2.php/apps/files_sharing/api/v1/shares';
|
private string $ocsApiUrl = '/ocs/v2.php/apps/files_sharing/api/v1/shares';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $davSpacesUrl = '/remote.php/dav/spaces/';
|
private string $davSpacesUrl = '/remote.php/dav/spaces/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
@@ -214,6 +214,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getSpaceByName(string $user, string $spaceName): array {
|
public function getSpaceByName(string $user, string $spaceName): array {
|
||||||
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user);
|
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user);
|
||||||
@@ -232,6 +233,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getSpaceByNameManager(string $user, string $spaceName): array {
|
public function getSpaceByNameManager(string $user, string $spaceName): array {
|
||||||
$this->theUserListsAllAvailableSpacesUsingTheGraphApi($user);
|
$this->theUserListsAllAvailableSpacesUsingTheGraphApi($user);
|
||||||
@@ -252,6 +254,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getFileData(string $user, string $spaceName, string $fileName): ResponseInterface {
|
public function getFileData(string $user, string $spaceName, string $fileName): ResponseInterface {
|
||||||
$space = $this->getSpaceByName($user, $spaceName);
|
$space = $this->getSpaceByName($user, $spaceName);
|
||||||
@@ -282,6 +285,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getFileId(string $user, string $spaceName, string $fileName): string {
|
public function getFileId(string $user, string $spaceName, string $fileName): string {
|
||||||
$fileData = $this->getFileData($user, $spaceName, $fileName)->getHeaders();
|
$fileData = $this->getFileData($user, $spaceName, $fileName)->getHeaders();
|
||||||
@@ -296,6 +300,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getETag(string $user, string $spaceName, string $fileName): string {
|
public function getETag(string $user, string $spaceName, string $fileName): string {
|
||||||
$fileData = $this->getFileData($user, $spaceName, $fileName)->getHeaders();
|
$fileData = $this->getFileData($user, $spaceName, $fileName)->getHeaders();
|
||||||
@@ -308,6 +313,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $userName
|
* @param string $userName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getUserIdByUserName(string $userName): string {
|
public function getUserIdByUserName(string $userName): string {
|
||||||
$this->featureContext->setResponse(GraphHelper::getUser(
|
$this->featureContext->setResponse(GraphHelper::getUser(
|
||||||
@@ -321,12 +327,11 @@ class SpacesContext implements Context {
|
|||||||
$rawBody = $this->featureContext->getResponse()->getBody()->getContents();
|
$rawBody = $this->featureContext->getResponse()->getBody()->getContents();
|
||||||
$response = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
|
$response = \json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
|
||||||
if (isset($response["id"])) {
|
if (isset($response["id"])) {
|
||||||
$user = $response;
|
return $response["id"];
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(__METHOD__ . " accounts-list is empty");
|
throw new Exception(__METHOD__ . " accounts-list is empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $user["id"];
|
|
||||||
throw new Exception(__METHOD__ . " user with name $userName not found");
|
throw new Exception(__METHOD__ . " user with name $userName not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +367,7 @@ class SpacesContext implements Context {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function cleanDataAfterTests(): void
|
public function cleanDataAfterTests(): void
|
||||||
{
|
{
|
||||||
@@ -375,7 +380,7 @@ class SpacesContext implements Context {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function deleteAllSpacesOfTheType(string $driveType): void
|
public function deleteAllSpacesOfTheType(string $driveType): void
|
||||||
{
|
{
|
||||||
@@ -463,16 +468,16 @@ class SpacesContext implements Context {
|
|||||||
/**
|
/**
|
||||||
* Send Graph List Single Space Request
|
* Send Graph List Single Space Request
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $urlArguments
|
* @param string $spaceId
|
||||||
* @param string $xRequestId
|
* @param string $urlArguments
|
||||||
* @param array $body
|
* @param string $xRequestId
|
||||||
* @param array $headers
|
* @param array $body
|
||||||
|
* @param array $headers
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
|
||||||
*/
|
*/
|
||||||
public function listSingleSpaceRequest(
|
public function listSingleSpaceRequest(
|
||||||
string $user,
|
string $user,
|
||||||
@@ -569,6 +574,7 @@ class SpacesContext implements Context {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function theUserListsAllHisAvailableSpacesUsingTheGraphApi(string $user): void {
|
public function theUserListsAllHisAvailableSpacesUsingTheGraphApi(string $user): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
@@ -587,6 +593,7 @@ class SpacesContext implements Context {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function theUserListsAllAvailableSpacesUsingTheGraphApi(string $user): void {
|
public function theUserListsAllAvailableSpacesUsingTheGraphApi(string $user): void {
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
@@ -622,8 +629,7 @@ class SpacesContext implements Context {
|
|||||||
* @When /^user "([^"]*)" looks up the single space "([^"]*)" via the GraphApi by using its id$/
|
* @When /^user "([^"]*)" looks up the single space "([^"]*)" via the GraphApi by using its id$/
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $query
|
* @param string $spaceName
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
@@ -632,7 +638,7 @@ class SpacesContext implements Context {
|
|||||||
$space = $this->getSpaceByName($user, $spaceName);
|
$space = $this->getSpaceByName($user, $spaceName);
|
||||||
Assert::assertIsArray($space);
|
Assert::assertIsArray($space);
|
||||||
Assert::assertNotEmpty($spaceId = $space["id"]);
|
Assert::assertNotEmpty($spaceId = $space["id"]);
|
||||||
Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]);
|
Assert::assertNotEmpty($space["root"]["webDavUrl"]);
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
$this->listSingleSpaceRequest(
|
$this->listSingleSpaceRequest(
|
||||||
$user,
|
$user,
|
||||||
@@ -798,8 +804,7 @@ class SpacesContext implements Context {
|
|||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param string $path
|
* @param string $foldersPath
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
@@ -961,6 +966,7 @@ class SpacesContext implements Context {
|
|||||||
*
|
*
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param string $userName
|
* @param string $userName
|
||||||
|
* @param string $fileName
|
||||||
* @param TableNode $table
|
* @param TableNode $table
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -1032,7 +1038,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $role
|
* @param string $role
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function checkPermissionsInResponse(
|
public function checkPermissionsInResponse(
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
@@ -1071,7 +1077,7 @@ class SpacesContext implements Context {
|
|||||||
/**
|
/**
|
||||||
* @Then /^the json responded should (not|only|)\s?contain spaces of type "([^"]*)"$/
|
* @Then /^the json responded should (not|only|)\s?contain spaces of type "([^"]*)"$/
|
||||||
*
|
*
|
||||||
* @param string $shoulOrNot (not|only|)
|
* @param string $onlyOrNot (not|only|)
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -1250,7 +1256,7 @@ class SpacesContext implements Context {
|
|||||||
for ($i = 0; $i < \count($exploded); $i++) {
|
for ($i = 0; $i < \count($exploded); $i++) {
|
||||||
$path = $path . $exploded[$i] . '/';
|
$path = $path . $exploded[$i] . '/';
|
||||||
$this->theUserCreatesAFolderToAnotherOwnerSpaceUsingTheGraphApi($user, $path, $spaceName);
|
$this->theUserCreatesAFolderToAnotherOwnerSpaceUsingTheGraphApi($user, $path, $spaceName);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1445,11 +1451,10 @@ class SpacesContext implements Context {
|
|||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param string $newName
|
* @param string $newDescription
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
* @throws Exception
|
* @throws JsonException
|
||||||
*/
|
*/
|
||||||
public function updateSpaceDescription(
|
public function updateSpaceDescription(
|
||||||
string $user,
|
string $user,
|
||||||
@@ -1607,6 +1612,7 @@ class SpacesContext implements Context {
|
|||||||
* @param int $quota
|
* @param int $quota
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userHasCreatedSpace(
|
public function userHasCreatedSpace(
|
||||||
string $user,
|
string $user,
|
||||||
@@ -1668,6 +1674,7 @@ class SpacesContext implements Context {
|
|||||||
* @param string $destination
|
* @param string $destination
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userHasUploadedFile(
|
public function userHasUploadedFile(
|
||||||
string $user,
|
string $user,
|
||||||
@@ -2161,7 +2168,7 @@ class SpacesContext implements Context {
|
|||||||
if ($objectInTrash["name"] === $object) {
|
if ($objectInTrash["name"] === $object) {
|
||||||
$expectedObject = $objectInTrash["name"];
|
$expectedObject = $objectInTrash["name"];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
if ($shouldOrNot === "not") {
|
if ($shouldOrNot === "not") {
|
||||||
Assert::assertEmpty($expectedObject, "$object is found in the trash, but should not be there");
|
Assert::assertEmpty($expectedObject, "$object is found in the trash, but should not be there");
|
||||||
} else {
|
} else {
|
||||||
@@ -2172,13 +2179,14 @@ class SpacesContext implements Context {
|
|||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" restores the (?:file|folder) "([^"]*)" from the trash of the space "([^"]*)" to "([^"]*)"$/
|
* @When /^user "([^"]*)" restores the (?:file|folder) "([^"]*)" from the trash of the space "([^"]*)" to "([^"]*)"$/
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $object
|
* @param string $object
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function userRestoresSpaceObjectsFromTrashRequest(
|
public function userRestoresSpaceObjectsFromTrashRequest(
|
||||||
string $user,
|
string $user,
|
||||||
@@ -2190,11 +2198,16 @@ class SpacesContext implements Context {
|
|||||||
|
|
||||||
// find object in trash
|
// find object in trash
|
||||||
$objectsInTrash = $this->getObjectsInTrashbin($user, $spaceName);
|
$objectsInTrash = $this->getObjectsInTrashbin($user, $spaceName);
|
||||||
|
$pathToDeletedObject = "";
|
||||||
foreach ($objectsInTrash as $objectInTrash) {
|
foreach ($objectsInTrash as $objectInTrash) {
|
||||||
if ($objectInTrash["name"] === $object) {
|
if ($objectInTrash["name"] === $object) {
|
||||||
$pathToDeletedObject = $objectInTrash["href"];
|
$pathToDeletedObject = $objectInTrash["href"];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
if ($pathToDeletedObject === "") {
|
||||||
|
throw new Exception(__METHOD__ . " Object '$object' was not found in the trashbin of user '$user' space '$spaceName'");
|
||||||
|
}
|
||||||
|
|
||||||
$destination = $this->baseUrl . $this->davSpacesUrl . $space["id"] . $destination;
|
$destination = $this->baseUrl . $this->davSpacesUrl . $space["id"] . $destination;
|
||||||
$header = ["Destination" => $destination, "Overwrite" => "F"];
|
$header = ["Destination" => $destination, "Overwrite" => "F"];
|
||||||
@@ -2214,7 +2227,7 @@ class SpacesContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User downloads a priview of the file inside of the project space
|
* User downloads a preview of the file inside the project space
|
||||||
* @When /^user "([^"]*)" downloads the preview of "([^"]*)" of the space "([^"]*)" with width "([^"]*)" and height "([^"]*)" using the WebDAV API$/
|
* @When /^user "([^"]*)" downloads the preview of "([^"]*)" of the space "([^"]*)" with width "([^"]*)" and height "([^"]*)" using the WebDAV API$/
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
@@ -2235,7 +2248,7 @@ class SpacesContext implements Context {
|
|||||||
$eTag = str_replace("\"", "", $this->getETag($user, $spaceName, $fileName));
|
$eTag = str_replace("\"", "", $this->getETag($user, $spaceName, $fileName));
|
||||||
$urlParameters = [
|
$urlParameters = [
|
||||||
'scalingup' => 0,
|
'scalingup' => 0,
|
||||||
'preview' => '1',
|
'preview' => '1',
|
||||||
'a' => '1',
|
'a' => '1',
|
||||||
'c' => $eTag,
|
'c' => $eTag,
|
||||||
'x' => $width,
|
'x' => $width,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use TestHelpers\HttpRequestHelper;
|
|||||||
require_once 'bootstrap.php';
|
require_once 'bootstrap.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context for the provisioning specific steps using the Graph API
|
* Context for the TUS-specific steps using the Graph API
|
||||||
*/
|
*/
|
||||||
class TusContext implements Context
|
class TusContext implements Context
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ class TusContext implements Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^user "([^"]*)" has uploaded a file "([^"]*)" via TUS inside of the space "([^"]*)" using WebDAV API$/
|
* @Given /^user "([^"]*)" has uploaded a file "([^"]*)" via TUS inside of the space "([^"]*)" using the WebDAV API$/
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $resource
|
* @param string $resource
|
||||||
@@ -80,7 +80,7 @@ class TusContext implements Context
|
|||||||
{
|
{
|
||||||
$resourceLocation = $this->getResourceLocation($user, $resource, $spaceName);
|
$resourceLocation = $this->getResourceLocation($user, $resource, $spaceName);
|
||||||
$file = \fopen($this->acceptanceTestsDirLocation() . $resource, 'r');
|
$file = \fopen($this->acceptanceTestsDirLocation() . $resource, 'r');
|
||||||
|
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::sendRequest(
|
HttpRequestHelper::sendRequest(
|
||||||
$resourceLocation,
|
$resourceLocation,
|
||||||
@@ -94,7 +94,7 @@ class TusContext implements Context
|
|||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200");
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Expected response status code should be 200");
|
||||||
|
|
||||||
|
|
||||||
$this->featureContext->setResponse(
|
$this->featureContext->setResponse(
|
||||||
HttpRequestHelper::sendRequest(
|
HttpRequestHelper::sendRequest(
|
||||||
$resourceLocation,
|
$resourceLocation,
|
||||||
@@ -111,12 +111,13 @@ class TusContext implements Context
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* send POST and return the url of the resource location in the response header
|
* send POST and return the url of the resource location in the response header
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $resource
|
* @param string $resource
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception|GuzzleException
|
||||||
*/
|
*/
|
||||||
public function getResourceLocation(string $user, string $resource, string $spaceName): string
|
public function getResourceLocation(string $user, string $resource, string $spaceName): string
|
||||||
{
|
{
|
||||||
@@ -148,5 +149,6 @@ class TusContext implements Context
|
|||||||
if (\sizeof($locationHeader) > 0) {
|
if (\sizeof($locationHeader) > 0) {
|
||||||
return $locationHeader[0];
|
return $locationHeader[0];
|
||||||
}
|
}
|
||||||
|
throw new \Exception(__METHOD__ . " Location header could not be found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user