Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests for public webDAV API step #335

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions tests/acceptance/features/apiAntivirus/antivirusFileSize.feature
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ Feature: Antivirus file size
| status | /^finished$/ |
And as "user0" file "/myChunkedFile.txt" should exist

Scenario: Files smaller than the upload threshold are checked for viruses when uploaded via public upload
Given as user "user0"
Scenario: Files smaller than the upload threshold are checked for viruses when uploaded via old public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
And parameter "av_max_file_size" of app "files_antivirus" has been set to "100"
When the public uploads file "eicar.com" from the antivirus test data folder using the old WebDAV API
Expand All @@ -98,13 +99,31 @@ Feature: Antivirus file size
| -- | files_antivirus | PUT | Infected file deleted |
And as "user0" file "/FOLDER/eicar.com" should not exist

Scenario: Files bigger than the upload threshold are not checked for viruses when uploaded via public upload
Given as user "user0"
@skip @issue-334
Scenario: Files smaller than the upload threshold are checked for viruses when uploaded via new public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
And parameter "av_max_file_size" of app "files_antivirus" has been set to "100"
When the public uploads file "eicar.com" from the antivirus test data folder using the new WebDAV API
Then the HTTP status code should be "403"
And the last lines of the log file should contain log-entries containing these attributes:
| user | app | method | message |
| -- | files_antivirus | PUT | Infected file deleted |
And as "user0" file "/FOLDER/eicar.com" should not exist

Scenario Outline: Files bigger than the upload threshold are not checked for viruses when uploaded via public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
And parameter "av_max_file_size" of app "files_antivirus" has been set to "100"
When the public uploads file "eicar_com.zip" from the antivirus test data folder using the old WebDAV API
When the public uploads file "eicar_com.zip" from the antivirus test data folder using the <public-webdav-api> WebDAV API
Then the HTTP status code should be "201"
And as "user0" file "/FOLDER/eicar_com.zip" should exist
Examples:
| public-webdav-api |
| new |
| old |

@skip @files_primary_s3#69
Scenario: Files smaller than the upload threshold are checked for viruses when uploaded overwriting via public upload
Expand All @@ -119,11 +138,16 @@ Feature: Antivirus file size
| -- | files_antivirus | PUT | Infected file deleted |
And the content of file "/FOLDER/textfile.txt" for user "user0" should be "Small text file without virus."

Scenario: Files bigger than the upload threshold are not checked for viruses when uploaded overwriting via public upload
Given as user "user0"
Scenario Outline: Files bigger than the upload threshold are not checked for viruses when uploaded overwriting via public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
And parameter "av_max_file_size" of app "files_antivirus" has been set to "60"
When the public uploads file "textfile.txt" from the antivirus test data folder using the old WebDAV API
When the public uploads file "textfile.txt" from the antivirus test data folder using the <public-webdav-api> WebDAV API
And the public overwrites file "textfile.txt" with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" using the old WebDAV API
Then the HTTP status code should be "204"
And the content of file "/FOLDER/textfile.txt" for user "user0" should be "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"
Examples:
| public-webdav-api |
| new |
| old |
33 changes: 28 additions & 5 deletions tests/acceptance/features/apiAntivirus/antivirusMain.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,21 @@ Feature: Antivirus basic
| status | /^error$/ |
And as "user0" file "/myChunkedFile.txt" should not exist

Scenario: A small file without a virus can be uploaded via public upload
Given as user "user0"
Scenario Outline: A small file without a virus can be uploaded via public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
When the public uploads file "textfile.txt" from the antivirus test data folder using the old WebDAV API
When the public uploads file "textfile.txt" from the antivirus test data folder using the <public-webdav-api> WebDAV API
Then the HTTP status code should be "201"
And as "user0" file "/FOLDER/textfile.txt" should exist
Examples:
| public-webdav-api |
| new |
| old |

Scenario Outline: A small file with a virus cannot be uploaded via public upload
Given as user "user0"
Scenario Outline: A small file with a virus cannot be uploaded via old public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
When the public uploads file "<virus-file-name>" from the antivirus test data folder using the old WebDAV API
Then the HTTP status code should be "403"
Expand All @@ -113,6 +119,23 @@ Feature: Antivirus basic
| eicar_com.zip |
| eicarcom2.zip |

@skip @issue-334
Scenario Outline: A small file with a virus cannot be uploaded via new public upload
Given the administrator has enabled DAV tech_preview
And as user "user0"
And user "user0" has created a public link share of folder "FOLDER" with change permissions
When the public uploads file "<virus-file-name>" from the antivirus test data folder using the new WebDAV API
Then the HTTP status code should be "403"
And the last lines of the log file should contain log-entries containing these attributes:
| user | app | method | message |
| -- | files_antivirus | PUT | Infected file deleted |
And as "user0" file "/FOLDER/<virus-file-name>" should not exist
Examples:
| virus-file-name |
| eicar.com |
| eicar_com.zip |
| eicarcom2.zip |

@skip @files_primary_s3#69
Scenario: A file cannot be overwritten with a file containing a virus via public upload
Given as user "user0"
Expand Down
7 changes: 4 additions & 3 deletions tests/acceptance/features/bootstrap/AntivirusContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ public function userUploadsFileFromAntivirusDataFolderTo(
}

/**
* @When the public uploads file ":filename" from the antivirus test data folder using the old WebDAV API
* @When /^the public uploads file "([^"]*)" from the antivirus test data folder using the (new|old) WebDAV API$/
* @Given the public has uploaded file ":filename" from the antivirus test data folder
*
* @param string $source target file name
* @param string $publicWebDavAPIVersion
*
* @return void
*/
public function publicUploadsFileFromAntivirusDataFolder($source) {
public function publicUploadsFileFromAntivirusDataFolder($source, $publicWebDavAPIVersion = "old") {
$source = $this->getRelativePathToTestDataFolder() . $source;
$this->publicWebDavContext->publiclyUploadingFile($source);
$this->publicWebDavContext->publiclyUploadingFile($source, $publicWebDavAPIVersion);
}

/**
Expand Down