Skip to content

Commit

Permalink
EICAR signature name has changed + change 20 seconds to 25 to match d…
Browse files Browse the repository at this point in the history
…ifferent envs
  • Loading branch information
GreatBahram committed Aug 3, 2021
1 parent 42a072e commit e09ae3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
sudo freshclam --verbose
sudo systemctl restart clamav-daemon.service
- name: Wait for 20 seconds until clamd socket becomes available
- name: Wait for 25 seconds until clamd socket becomes available
run: |
secs=20
secs=25
while [[ $secs -gt 0 ]] && ! [[ -f "/var/run/clamav/clamd.ctl" ]];
do
echo -ne "$secs\033[0K\r"
Expand Down
11 changes: 6 additions & 5 deletions src/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
mine = (stat.S_IREAD | stat.S_IWRITE)
other = stat.S_IROTH
execute = (stat.S_IEXEC | stat.S_IXOTH)
EICAR_SIG_NAME = "Win.Test.EICAR_HDB-1"


@contextmanager
Expand Down Expand Up @@ -42,7 +43,7 @@ def test_scan(self):
f.write(clamd.EICAR)
f.flush()
os.fchmod(f.fileno(), (mine | other))
expected = {f.name: ('FOUND', 'Eicar-Test-Signature')}
expected = {f.name: ('FOUND', EICAR_SIG_NAME)}

assert self.cd.scan(f.name) == expected

Expand All @@ -51,7 +52,7 @@ def test_unicode_scan(self):
f.write(clamd.EICAR)
f.flush()
os.fchmod(f.fileno(), (mine | other))
expected = {f.name: ('FOUND', 'Eicar-Test-Signature')}
expected = {f.name: ('FOUND', EICAR_SIG_NAME)}

assert self.cd.scan(f.name) == expected

Expand All @@ -62,13 +63,13 @@ def test_multiscan(self):
with open(os.path.join(d, "file" + str(i)), 'wb') as f:
f.write(clamd.EICAR)
os.fchmod(f.fileno(), (mine | other))
expected[f.name] = ('FOUND', 'Eicar-Test-Signature')
expected[f.name] = ('FOUND', EICAR_SIG_NAME)
os.chmod(d, (mine | other | execute))

assert self.cd.multiscan(d) == expected

def test_instream(self):
expected = {'stream': ('FOUND', 'Eicar-Test-Signature')}
expected = {'stream': ('FOUND', EICAR_SIG_NAME)}
assert self.cd.instream(BytesIO(clamd.EICAR)) == expected

def test_insteam_success(self):
Expand All @@ -79,7 +80,7 @@ def test_fdscan(self):
f.write(clamd.EICAR)
f.flush()
os.fchmod(f.fileno(), (mine | other))
expected = {f.name: ('FOUND', 'Eicar-Test-Signature')}
expected = {f.name: ('FOUND', EICAR_SIG_NAME)}

assert self.cd.fdscan(f.name) == expected

Expand Down

0 comments on commit e09ae3c

Please sign in to comment.