mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 21:00:30 -06:00
added step to check notification with subject and resource (#6675)
This commit is contained in:
@@ -226,14 +226,14 @@ Feature: antivirus
|
||||
And user "Alice" has created a folder "uploadFolder" in space "new-space"
|
||||
When user "Alice" uploads a file "filesForUpload/filesWithVirus/<filename>" to "/uploadFolder/<newfilename>" in space "new-space" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
And user "Alice" should get a notification with subject "Virus found" and message:
|
||||
And user "Alice" should get a notification for resource "<newfilename>" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in <newfilename>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And for user "Alice" the space "new-space" should not contain these entries:
|
||||
| /uploadFolder/<newfilename> |
|
||||
When user "Alice" uploads a file "filesForUpload/filesWithVirus/<filename>" to "/<newfilename>" in space "new-space" using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
And user "Alice" should get a notification with subject "Virus found" and message:
|
||||
And user "Alice" should get a notification for resource "<newfilename>" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in <newfilename>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And for user "Alice" the space "new-space" should not contain these entries:
|
||||
@@ -422,15 +422,15 @@ Feature: antivirus
|
||||
And user "Brian" has accepted share "/test.txt" offered by user "Alice"
|
||||
When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/uploadFolder/test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should get a notification with subject "Virus found" and message:
|
||||
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And the content of file "Shares/uploadFolder/test.txt" for user "Brian" should be "this is a test file."
|
||||
And the content of file "uploadFolder/test.txt" for user "Alice" should be "this is a test file."
|
||||
When user "Brian" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "Shares/test.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should get a notification with subject "Virus found" and message:
|
||||
| message |
|
||||
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And the content of file "Shares/test.txt" for user "Brian" should be "this is a test file."
|
||||
And the content of file "/test.txt" for user "Alice" should be "this is a test file."
|
||||
@@ -452,14 +452,14 @@ Feature: antivirus
|
||||
And user "Brian" has accepted share "/test.txt" offered by user "Alice"
|
||||
When user "Brian" uploads a file "filesForUpload/filesWithVirus/eicar.com" to "/uploadFolder/test.txt" in space "Shares" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should get a notification with subject "Virus found" and message:
|
||||
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And for user "Brian" the content of the file "/uploadFolder/test.txt" of the space "Shares" should be "this is a test file."
|
||||
And the content of file "uploadFolder/test.txt" for user "Alice" should be "this is a test file."
|
||||
When user "Brian" uploads a file "filesForUpload/filesWithVirus/eicar.com" to "/test.txt" in space "Shares" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And user "Brian" should get a notification with subject "Virus found" and message:
|
||||
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
|
||||
| message |
|
||||
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
|
||||
And for user "Brian" the content of the file "/test.txt" of the space "Shares" should be "this is a test file."
|
||||
|
||||
@@ -343,6 +343,38 @@ class NotificationContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should get a notification for resource :resource with subject :subject and message:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $resource
|
||||
* @param string $subject
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userShouldGetNotificationForResourceWithMessage(string $user, string $resource, string $subject, TableNode $table):void {
|
||||
$this->userListAllNotifications($user);
|
||||
$notification = $this->filterResponseByNotificationSubjectAndResource($subject, $resource);
|
||||
|
||||
if (\count($notification) === 1) {
|
||||
$actualMessage = str_replace(["\r", "\r"], " ", $notification[0]->message);
|
||||
$expectedMessage = $table->getColumnsHash()[0]['message'];
|
||||
Assert::assertSame(
|
||||
$expectedMessage,
|
||||
$actualMessage,
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
|
||||
);
|
||||
$this->userDeletesNotificationOfResourceAndSubject($user, $resource, $subject);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200);
|
||||
} elseif (\count($notification) === 0) {
|
||||
throw new \Exception("Response doesn't contain any notification with resource '$resource' and subject '$subject'.\n$notification");
|
||||
} else {
|
||||
throw new \Exception("Response contains more than one notification with resource '$resource' and subject '$subject'.\n$notification");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should not have a notification related to resource :resource with subject :subject
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user