File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1- #!/usr/bin/env python
2- # -*- coding: utf-8 -*-
3- from __future__ import unicode_literals
4- import clamd
5- from io import BytesIO
6- from contextlib import contextmanager
7- import tempfile
8- import shutil
91import os
2+ import shutil
103import stat
4+ import tempfile
5+ from contextlib import contextmanager
6+ from io import BytesIO
117
8+ import clamd
129import pytest
1310
1411mine = (stat .S_IREAD | stat .S_IWRITE )
@@ -77,6 +74,15 @@ def test_instream(self):
7774 def test_insteam_success (self ):
7875 assert self .cd .instream (BytesIO (b"foo" )) == {'stream' : ('OK' , None )}
7976
77+ def test_fdscan (self ):
78+ with tempfile .NamedTemporaryFile ('wb' , prefix = "python-clamd" ) as f :
79+ f .write (clamd .EICAR )
80+ f .flush ()
81+ os .fchmod (f .fileno (), (mine | other ))
82+ expected = {f .name : ('FOUND' , 'Eicar-Test-Signature' )}
83+
84+ assert self .cd .fdscan (f .name ) == expected
85+
8086
8187class TestUnixSocketTimeout (TestUnixSocket ):
8288 kwargs = {"timeout" : 20 }
You can’t perform that action at this time.
0 commit comments