Skip to content

Commit 413bf93

Browse files
author
Niraj Acharya
committed
test: fix antivirus tests
1 parent 624b646 commit 413bf93

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

tests/acceptance/bootstrap/NotificationContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public function userShouldGetANotificationWithMessage(string $user, string $subj
436436
throw new \Exception("Notification was not found even after retrying for 5 seconds.");
437437
}
438438
$expectedMessage = $table->getColumnsHash()[0]['message'];
439-
Assert::assertSame(
439+
Assert::assertStringContainsString(
440440
$expectedMessage,
441441
$actualMessage,
442442
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'",
@@ -466,7 +466,7 @@ public function userShouldGetNotificationForResourceWithMessage(
466466
if (\count($notification) === 1) {
467467
$actualMessage = str_replace(["\r", "\r"], " ", $notification[0]->message);
468468
$expectedMessage = $table->getColumnsHash()[0]['message'];
469-
Assert::assertSame(
469+
Assert::assertStringContainsString(
470470
$expectedMessage,
471471
$actualMessage,
472472
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'",

tests/acceptance/features/apiAntivirus/antivirus.feature

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Feature: antivirus
3232
# antivirus service can scan files during post-processing. on demand scanning is currently not available
3333
Then the HTTP status code should be "201"
3434
And user "Alice" should get a notification with subject "Virus found" and message:
35-
| message |
36-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
35+
| message |
36+
| Virus found in <new-file-name>. Upload not possible. |
3737
And as "Alice" file "<new-file-name>" should not exist
3838
Examples:
3939
| dav-path-version | file-name | new-file-name |
@@ -53,8 +53,8 @@ Feature: antivirus
5353
And user "Alice" uploads file "filesForUpload/textfile.txt" to "/normalfile.txt" using the WebDAV API
5454
And the HTTP status code should be "201"
5555
And user "Alice" should get a notification with subject "Virus found" and message:
56-
| message |
57-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
56+
| message |
57+
| Virus found in <new-file-name>. Upload not possible. |
5858
And as "Alice" file "<new-file-name>" should not exist
5959
But as "Alice" file "/normalfile.txt" should exist
6060
And the content of file "/normalfile.txt" for user "Alice" should be:
@@ -83,8 +83,8 @@ Feature: antivirus
8383
# antivirus service can scan files during post-processing. on demand scanning is currently not available
8484
Then the HTTP status code should be "201"
8585
And user "Alice" should get a notification with subject "Virus found" and message:
86-
| message |
87-
| Virus found in myChunkedFile.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
86+
| message |
87+
| Virus found in myChunkedFile.txt. Upload not possible. |
8888
And as "Alice" file "/myChunkedFile.txt" should not exist
8989
Examples:
9090
| dav-path-version |
@@ -106,8 +106,8 @@ Feature: antivirus
106106
When the public uploads file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>" inside last link shared folder using the public WebDAV API
107107
Then the HTTP status code should be "201"
108108
And user "Alice" should get a notification with subject "Virus found" and message:
109-
| message |
110-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
109+
| message |
110+
| Virus found in <new-file-name>. Upload not possible. Virus: |
111111
And as "Alice" file "/uploadFolder/<new-file-name>" should not exist
112112
Examples:
113113
| dav-path-version | file-name | new-file-name |
@@ -132,8 +132,8 @@ Feature: antivirus
132132
When the public uploads file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>" inside last link shared folder with password "%public%" using the public WebDAV API
133133
Then the HTTP status code should be "201"
134134
And user "Alice" should get a notification with subject "Virus found" and message:
135-
| message |
136-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
135+
| message |
136+
| Virus found in <new-file-name>. Upload not possible. |
137137
And as "Alice" file "/uploadFolder/<new-file-name>" should not exist
138138
Examples:
139139
| dav-path-version | file-name | new-file-name |
@@ -159,8 +159,8 @@ Feature: antivirus
159159
When user "Brian" uploads file "filesForUpload/filesWithVirus/<file-name>" to "/Shares/uploadFolder/<new-file-name>" using the WebDAV API
160160
Then the HTTP status code should be "201"
161161
And user "Brian" should get a notification with subject "Virus found" and message:
162-
| message |
163-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
162+
| message |
163+
| Virus found in <new-file-name>. Upload not possible. |
164164
And as "Brian" file "/Shares/uploadFolder/<new-file-name>" should not exist
165165
And as "Alice" file "/uploadFolder/<new-file-name>" should not exist
166166
Examples:
@@ -189,8 +189,8 @@ Feature: antivirus
189189
When user "Brian" uploads file "filesForUpload/filesWithVirus/<file-name>" to "/Shares/uploadFolder/<new-file-name>" using the WebDAV API
190190
Then the HTTP status code should be "201"
191191
And user "Brian" should get a notification with subject "Virus found" and message:
192-
| message |
193-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
192+
| message |
193+
| Virus found in <new-file-name>. Upload not possible. |
194194
And as "Brian" file "/Shares/uploadFolder/<new-file-name>" should not exist
195195
And as "Alice" file "/uploadFolder/<new-file-name>" should not exist
196196
Examples:
@@ -211,15 +211,15 @@ Feature: antivirus
211211
When user "Alice" uploads a file "filesForUpload/filesWithVirus/<file-name>" to "/uploadFolder/<new-file-name>" in space "new-space" using the WebDAV API
212212
Then the HTTP status code should be "201"
213213
And user "Alice" should get a notification for resource "<new-file-name>" with subject "Virus found" and message:
214-
| message |
215-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
214+
| message |
215+
| Virus found in <new-file-name>. Upload not possible. |
216216
And for user "Alice" folder "uploadFolder" of the space "new-space" should not contain these entries:
217217
| <new-file-name> |
218218
When user "Alice" uploads a file "filesForUpload/filesWithVirus/<file-name>" to "/<new-file-name>" in space "new-space" using the WebDAV API
219219
Then the HTTP status code should be "201"
220220
And user "Alice" should get a notification for resource "<new-file-name>" with subject "Virus found" and message:
221-
| message |
222-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
221+
| message |
222+
| Virus found in <new-file-name>. Upload not possible. |
223223
And for user "Alice" the space "new-space" should not contain these entries:
224224
| /<new-file-name> |
225225
Examples:
@@ -241,8 +241,8 @@ Feature: antivirus
241241
When user "Brian" uploads a file "/filesForUpload/filesWithVirus/<file-name>" to "/<new-file-name>" in space "new-space" using the WebDAV API
242242
Then the HTTP status code should be "201"
243243
And user "Brian" should get a notification with subject "Virus found" and message:
244-
| message |
245-
| Virus found in <new-file-name>. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
244+
| message |
245+
| Virus found in <new-file-name>. Upload not possible. |
246246
And for user "Brian" the space "new-space" should not contain these entries:
247247
| /<new-file-name> |
248248
And for user "Alice" the space "new-space" should not contain these entries:
@@ -272,8 +272,8 @@ Feature: antivirus
272272
When user "Alice" uploads file "filesForUpload/filesWithVirus/eicar.com" to "/aFileWithVirus.txt" using the WebDAV API
273273
Then the HTTP status code should be "201"
274274
And user "Alice" should get a notification with subject "Virus found" and message:
275-
| message |
276-
| Virus found in aFileWithVirus.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
275+
| message |
276+
| Virus found in aFileWithVirus.txt. Upload not possible. |
277277
And as "Alice" file "/aFileWithVirus.txt" should not exist
278278
Examples:
279279
| dav-path-version |
@@ -306,12 +306,12 @@ Feature: antivirus
306306
And as "Alice" file "/aFileWithVirus.txt" should not exist
307307
Examples:
308308
| dav-path-version | language | subject | message |
309-
| old | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. Virus: Win.Test.EICAR_HDB-1 |
310-
| new | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. Virus: Win.Test.EICAR_HDB-1 |
311-
| spaces | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. Virus: Win.Test.EICAR_HDB-1 |
312-
| old | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. Grund: Win.Test.EICAR_HDB-1 |
313-
| new | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. Grund: Win.Test.EICAR_HDB-1 |
314-
| spaces | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. Grund: Win.Test.EICAR_HDB-1 |
309+
| old | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. |
310+
| new | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. |
311+
| spaces | es | Virus encontrado | Virus encontrado en aFileWithVirus.txt. La subida no ha sido posible. |
312+
| old | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. |
313+
| new | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. |
314+
| spaces | de | Virus gefunden | In aFileWithVirus.txt wurde potenziell schädlicher Code gefunden. Das Hochladen wurde abgebrochen. |
315315

316316
@issue-enterprise-5709
317317
Scenario Outline: try to create a version of file by uploading virus content
@@ -321,8 +321,8 @@ Feature: antivirus
321321
When user "Alice" uploads file with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to "test.txt" using the WebDAV API
322322
Then the HTTP status code should be "204"
323323
And user "Alice" should get a notification with subject "Virus found" and message:
324-
| message |
325-
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
324+
| message |
325+
| Virus found in test.txt. Upload not possible. |
326326
And as "Alice" file "/test.txt" should exist
327327
And the version folder of file "/test.txt" for user "Alice" should contain "1" element
328328
And the content of file "/test.txt" for user "Alice" should be "hello nepal"
@@ -348,8 +348,8 @@ Feature: antivirus
348348
When the public overwrites file "test.txt" with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" using the public WebDAV API
349349
Then the HTTP status code should be "204"
350350
And user "Alice" should get a notification with subject "Virus found" and message:
351-
| message |
352-
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
351+
| message |
352+
| Virus found in test.txt. Upload not possible. |
353353
And the content of file "/test.txt" for user "Alice" should be "hello"
354354
Examples:
355355
| dav-path-version |
@@ -375,8 +375,8 @@ Feature: antivirus
375375
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
376376
Then the HTTP status code should be "204"
377377
And user "Brian" should get a notification with subject "Virus found" and message:
378-
| message |
379-
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
378+
| message |
379+
| Virus found in test.txt. Upload not possible. |
380380
And the content of file "/test.txt" for user "Alice" should be "hello"
381381
And the content of file "Shares/test.txt" for user "Brian" should be "hello"
382382
Examples:
@@ -409,15 +409,15 @@ Feature: antivirus
409409
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
410410
Then the HTTP status code should be "204"
411411
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
412-
| message |
413-
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
412+
| message |
413+
| Virus found in test.txt. Upload not possible. |
414414
And the content of file "Shares/uploadFolder/test.txt" for user "Brian" should be "this is a test file."
415415
And the content of file "uploadFolder/test.txt" for user "Alice" should be "this is a test file."
416416
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
417417
Then the HTTP status code should be "204"
418418
And user "Brian" should get a notification for resource "test.txt" with subject "Virus found" and message:
419-
| message |
420-
| Virus found in test.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
419+
| message |
420+
| Virus found in test.txt. Upload not possible. |
421421
And the content of file "Shares/test.txt" for user "Brian" should be "this is a test file."
422422
And the content of file "/test.txt" for user "Alice" should be "this is a test file."
423423
Examples:
@@ -436,8 +436,8 @@ Feature: antivirus
436436
When user "Alice" uploads a file inside space "new-space" with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to ".space/readme.md" using the WebDAV API
437437
Then the HTTP status code should be "204"
438438
And user "Alice" should get a notification with subject "Virus found" and message:
439-
| message |
440-
| Virus found in readme.md. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
439+
| message |
440+
| Virus found in readme.md. Upload not possible. |
441441
And for user "Alice" the content of the file ".space/readme.md" of the space "new-space" should be "Here you can add a description for this Space."
442442

443443

@@ -457,8 +457,8 @@ Feature: antivirus
457457
When user "Brian" uploads a file inside space "new-space" with content "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" to ".space/readme.md" using the WebDAV API
458458
Then the HTTP status code should be "204"
459459
And user "Brian" should get a notification with subject "Virus found" and message:
460-
| message |
461-
| Virus found in readme.md. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
460+
| message |
461+
| Virus found in readme.md. Upload not possible. |
462462
And for user "Brian" the content of the file ".space/readme.md" of the space "new-space" should be "Here you can add a description for this Space."
463463
And for user "Alice" the content of the file ".space/readme.md" of the space "new-space" should be "Here you can add a description for this Space."
464464

@@ -477,7 +477,7 @@ Feature: antivirus
477477
When user "Brian" uploads a file "filesForUpload/filesWithVirus/eicar.com" to "text.txt" in space "new-space" using the WebDAV API
478478
Then the HTTP status code should be "204"
479479
And user "Brian" should get a notification with subject "Virus found" and message:
480-
| message |
481-
| Virus found in text.txt. Upload not possible. Virus: Win.Test.EICAR_HDB-1 |
480+
| message |
481+
| Virus found in text.txt. Upload not possible. |
482482
And for user "Brian" the content of the file "/text.txt" of the space "new-space" should be "hello world"
483483
And for user "Alice" the content of the file "/text.txt" of the space "new-space" should be "hello world"

0 commit comments

Comments
 (0)