Skip to content

Commit

Permalink
Test scenario with missing file report entry
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Sep 18, 2024
1 parent aabcf12 commit f25f295
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/test_unit_scanner.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
from errno import EPIPE
from unittest import mock

import pytest

from clamav_client.clamd import BufferTooLongError
from clamav_client.clamd import CommunicationError
from clamav_client.scanner import ClamdScanner
from clamav_client.scanner import ClamscanScanner
from clamav_client.scanner import Scanner
from clamav_client.scanner import ScannerInfo
from clamav_client.scanner import ScanResult


@mock.patch.object(
ClamdScanner,
"_pass_by_stream",
return_value={
"/tmp/file": ScanResult(
filename="/tmp/file", state=None, details=None, err=None
),
},
)
def test_clamdscanner_missing_result_entry(mock: mock.Mock) -> None:
result = ClamdScanner({}).scan("/tmp/file")

assert result == ScanResult(
filename="/tmp/file", state=None, details=None, err=None
)


def test_scan_result_eq() -> None:
result1 = ScanResult(filename="f", state=None, details=None, err=None)
result2 = ScanResult(filename="f", state=None, details=None, err=None)
Expand Down

0 comments on commit f25f295

Please sign in to comment.