Skip to content

Commit

Permalink
Disable tests referring to a test virus zip files that are nolonger d…
Browse files Browse the repository at this point in the history
…ownloadable; Add more debug to failing test that should be apssing
  • Loading branch information
asset-web committed Jul 2, 2024
1 parent 89f47d8 commit 69c85c6
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions tests/test_clamav.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import datetime
import logging
import os
from unittest import skip

import magic
import requests
Expand All @@ -21,8 +22,9 @@

BASE_DIR = os.path.dirname(__file__)
VIRUS_TXT_FILE_URL = "https://secure.eicar.org/eicar.com.txt"
VIRUS_ZIP_FILE_URL = "https://secure.eicar.org/eicar_com.zip"
VIRUS_DEEP_ZIP_FILE_URL = "https://secure.eicar.org/eicarcom2.zip"
# Below zip files are currently unavailable and tests are being disabled. NB: .zip uploads are not allowable.
# VIRUS_ZIP_FILE_URL = "https://secure.eicar.org/eicar_com.zip"
# VIRUS_DEEP_ZIP_FILE_URL = "https://secure.eicar.org/eicarcom2.zip"


@tag('clamav', 'selenium-test')
Expand Down Expand Up @@ -55,7 +57,7 @@ def _assert_virus_scanning(self, upload_url, virus_file_url):
# Verify no new Upload objects were created.
self.assertEqual(Upload.objects.all().count(), previous_upload_count)
# Assert reason for lack of upload
self.assertTrue("File is infected with malware" in self.driver.page_source)
self.assertTrue("File is infected with malware" in self.driver.page_source, msg=self.driver.page_source)

# delete virus file
os.remove(file_path)
Expand Down Expand Up @@ -90,25 +92,25 @@ def test_upload_sample_b_ovid_bz_archive(self):
abstract_file_path = os.path.join(BASE_DIR, "07-32-54-exercise-inflamm-breast-cancer-may-3-2019-expanded-terms.txt.gz")
self._assert_file_upload(url=reverse("search_ovid_medline"), file_path=abstract_file_path)

@tag('scanning')
def test_scanning_ovid_zip_files(self):
"Trigger virus scanner file uploads with EICAR zip with OVID upload form."
self._assert_virus_scanning(reverse("search_ovid_medline"), VIRUS_ZIP_FILE_URL)

@tag('scanning')
def test_scanning_ovid_deep_zip_files(self):
"Trigger virus scanner file uploads with EICAR deep zip with OVID upload form."
self._assert_virus_scanning(reverse("search_ovid_medline"), VIRUS_DEEP_ZIP_FILE_URL)

@tag('scanning')
def test_scanning_pubmed_zip_files(self):
"Trigger virus scanner file uploads with EICAR zip with PubMed upload form."
self._assert_virus_scanning(reverse("search_pubmed"), VIRUS_ZIP_FILE_URL)

@tag('scanning')
def test_scanning_oubmed_deep_zip_files(self):
"Trigger virus scanner file uploads with EICAR deep zip with PubMed upload form."
self._assert_virus_scanning(reverse("search_pubmed"), VIRUS_DEEP_ZIP_FILE_URL)
# @tag('scanning')
# def test_scanning_ovid_zip_files(self):
# "Trigger virus scanner file uploads with EICAR zip with OVID upload form."
# self._assert_virus_scanning(reverse("search_ovid_medline"), VIRUS_ZIP_FILE_URL)

# @tag('scanning')
# def test_scanning_ovid_deep_zip_files(self):
# "Trigger virus scanner file uploads with EICAR deep zip with OVID upload form."
# self._assert_virus_scanning(reverse("search_ovid_medline"), VIRUS_DEEP_ZIP_FILE_URL)

# @tag('scanning')
# def test_scanning_pubmed_zip_files(self):
# "Trigger virus scanner file uploads with EICAR zip with PubMed upload form."
# self._assert_virus_scanning(reverse("search_pubmed"), VIRUS_ZIP_FILE_URL)

# @tag('scanning')
# def test_scanning_oubmed_deep_zip_files(self):
# "Trigger virus scanner file uploads with EICAR deep zip with PubMed upload form."
# self._assert_virus_scanning(reverse("search_pubmed"), VIRUS_DEEP_ZIP_FILE_URL)


class ScanOnUploadTestCase(ScanOnUploadInterface):
Expand Down

0 comments on commit 69c85c6

Please sign in to comment.