[tests-only][full-ci] changed given statement of sharing link in api antivirus feature file (#8914)

* changed given statement of sharing link in api antivirus feature file

* updated scenerio of uploading virus inside public share

* added step defnitin for uploading file via public link
This commit is contained in:
Sabin Panta
2024-04-30 12:26:21 +05:45
committed by GitHub
parent 34b13f96e8
commit 8b9d5da7ec
4 changed files with 175 additions and 40 deletions
@@ -185,6 +185,15 @@ class FeatureContext extends BehatVariablesContext {
private bool $dbConversion = false;
public const SHARES_SPACE_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668';
private bool $useSharingNG = false;
/**
* @return bool
*/
public function isUsingSharingNG(): bool {
return $this->useSharingNG;
}
/**
* @param bool $value
*
@@ -1009,6 +1018,15 @@ class FeatureContext extends BehatVariablesContext {
);
}
/**
* @Given using SharingNG
*
* @return void
*/
public function usingSharingNG(): void {
$this->useSharingNG = true;
}
/**
* @Given /^using OCS API version "([^"]*)"$/
*
@@ -1506,6 +1506,65 @@ class PublicWebDavContext implements Context {
}
}
/**
* @When the public uploads file :source to :destination inside last link shared folder using the :new WebDAV API
*
* @param string $source
* @param string $destination
* @param string $publicWebDAVAPIVersion
*
* @return void
*/
public function thePublicUploadsFileToInsideLastLinkSharedFolderUsingTheNewWebdavApi(
string $source,
string $destination,
string $publicWebDAVAPIVersion
):void {
$content = \file_get_contents(
$this->featureContext->acceptanceTestsDirLocation() . $source
);
$response = $this->publicUploadContent(
$destination,
'',
$content,
false,
[],
$publicWebDAVAPIVersion
);
$this->featureContext->setResponse($response);
}
/**
*
* @When the public uploads file :source to :destination inside last link shared folder with password :password using the :new WebDAV API
*
* @param string $source
* @param string $destination
* @param string $password
* @param string $publicWebDAVAPIVersion
*
* @return void
*/
public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsingTheNewWebdavApi(
string $source,
string $destination,
string $password,
string $publicWebDAVAPIVersion
):void {
$content = \file_get_contents(
$this->featureContext->acceptanceTestsDirLocation() . $source
);
$response = $this->publicUploadContent(
$destination,
$password,
$content,
false,
[],
$publicWebDAVAPIVersion
);
$this->featureContext->setResponse($response);
}
/**
* @When the public uploads file :fileName to the last public link shared folder with password :password with mtime :mtime using the :davVersion public WebDAV API
*
@@ -1704,7 +1763,11 @@ class PublicWebDavContext implements Context {
return null;
}
$password = $this->featureContext->getActualPassword($password);
$token = $this->featureContext->getLastCreatedPublicShareToken();
if ($this->featureContext->isUsingSharingNG()) {
$token = $this->featureContext->shareNgGetLastCreatedLinkShareToken();
} else {
$token = $this->featureContext->getLastCreatedPublicShareToken();
}
$davPath = WebDavHelper::getDavPath(
$token,
0,