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
9
1
import os
2
+ import shutil
10
3
import stat
4
+ import tempfile
5
+ from contextlib import contextmanager
6
+ from io import BytesIO
11
7
8
+ import clamd
12
9
import pytest
13
10
14
11
mine = (stat .S_IREAD | stat .S_IWRITE )
@@ -77,6 +74,15 @@ def test_instream(self):
77
74
def test_insteam_success (self ):
78
75
assert self .cd .instream (BytesIO (b"foo" )) == {'stream' : ('OK' , None )}
79
76
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
+
80
86
81
87
class TestUnixSocketTimeout (TestUnixSocket ):
82
88
kwargs = {"timeout" : 20 }
You can’t perform that action at this time.
0 commit comments