Skip to content

Commit

Permalink
make tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
tschorr committed Jan 21, 2021
1 parent 32e0b70 commit 38fa5ca
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/collective/clamav/tests/test_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ def test_net_scanBuffer(self):
""" Try a virus through the net.
"""

self.assertEqual(
self.scanner.scanBuffer(EICAR, type='net'),
'Win.Test.EICAR_HDB-1')
self.assertIsNotNone(
self.scanner.scanBuffer(EICAR, type='net'))

# And a normal file...
self.assertEqual(
self.scanner.scanBuffer(b'Not a virus', type='net'),
None)
self.assertIsNone(
self.scanner.scanBuffer(b'Not a virus', type='net'))

# Test timeout
self.assertRaises(
Expand All @@ -75,18 +73,17 @@ def test_unix_socket_scanBuffer(self):
""" Try a virus through a unix socket.
"""

self.assertEqual(
self.assertIsNotNone(
self.scanner.scanBuffer(
EICAR, type='socket',
socketpath='/tmp/clamd.socket'),
'Win.Test.EICAR_HDB-1')
socketpath='/tmp/clamd.socket'))

# And a normal file...
self.assertEqual(
self.assertIsNone(
self.scanner.scanBuffer(
b'Not a virus', type='socket',
socketpath='/tmp/clamd.socket',
), None)
))

# Test timeout
self.assertRaises(
Expand Down

0 comments on commit 38fa5ca

Please sign in to comment.