-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3514288
commit 9a41de5
Showing
3 changed files
with
48 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bats | ||
|
||
|
||
setup_file() { | ||
echo 'nothingwronghere' > /tmp/clean.txt | ||
echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > /tmp/eicar.com.txt | ||
curl --output /tmp/pup.exe http://amtso.eicar.org/PotentiallyUnwanted.exe | ||
docker exec --env OC_PASS=myfancysecurepassword234 --user www-data nextcloud-container php occ user:add testuser --password-from-env || echo "already exists" | ||
} | ||
|
||
@test "test admin eicar Upload" { | ||
RESULT=$(curl --silent -u admin:admin -T /tmp/eicar.com.txt http://127.0.0.1/remote.php/dav/files/admin/eicar.com.txt) | ||
[[ "$RESULT" =~ "Virus EICAR-Test-File is detected in the file. Upload cannot be completed." ]] | ||
} | ||
|
||
@test "test admin clean Upload" { | ||
STATUS_CODE=$(curl --silent -w "%{http_code}" -u admin:admin -T /tmp/clean.txt http://127.0.0.1/remote.php/dav/files/admin/clean.txt) | ||
[[ $STATUS_CODE -ge 200 && $STATUS_CODE -lt 300 ]] | ||
} | ||
|
||
@test "test admin pup Upload" { | ||
STATUS_CODE=$(curl --silent -w "%{http_code}" -u admin:admin -T /tmp/pup.exe http://127.0.0.1/remote.php/dav/files/admin/pup.exe) | ||
[[ $STATUS_CODE -ge 200 && $STATUS_CODE -lt 300 ]] | ||
} | ||
|
||
@test "test testuser eicar Upload" { | ||
RESULT=$(curl --silent -u testuser:myfancysecurepassword234 -T /tmp/eicar.com.txt http://127.0.0.1/remote.php/dav/files/testuser/eicar.com.txt) | ||
[[ "$RESULT" =~ "Virus EICAR-Test-File is detected in the file. Upload cannot be completed." ]] | ||
} | ||
|
||
@test "test testuser clean Upload" { | ||
STATUS_CODE=$(curl --silent -w "%{http_code}" -u testuser:myfancysecurepassword234 -T /tmp/clean.txt http://127.0.0.1/remote.php/dav/files/testuser/clean.txt) | ||
[[ $STATUS_CODE -ge 200 && $STATUS_CODE -lt 300 ]] || exit 1 | ||
} | ||
|
||
@test "test testuser pup Upload" { | ||
STATUS_CODE=$(curl --silent -w "%{http_code}" -u testuser:myfancysecurepassword234 -T /tmp/pup.exe http://127.0.0.1/remote.php/dav/files/testuser/pup.exe) | ||
[[ $STATUS_CODE -ge 200 && $STATUS_CODE -lt 300 ]] || exit 1 | ||
} | ||
|