tests.test_virustotal moduleΒΆ
Tests for VirusTotal module.
- tests.test_virustotal.test_detection_stats_clean()[source]ΒΆ
Clean file: zero flagged out of total engines.
- tests.test_virustotal.test_detection_stats_flagged()[source]ΒΆ
File with detections: malicious + suspicious count.
- tests.test_virustotal.test_scan_record_roundtrip(sample_records)[source]ΒΆ
Records survive the CSV row they are committed as.
- tests.test_virustotal.test_scan_record_key(sample_records)[source]ΒΆ
Identity is the (sha256, scanned) pair.
- tests.test_virustotal.test_records_from_results_skips_pending()[source]ΒΆ
Results without detection stats produce no record.
- tests.test_virustotal.test_records_from_results_stamps_today()[source]ΒΆ
The scan date defaults to today in YYYY-MM-DD form.
- tests.test_virustotal.test_records_from_release_notes()[source]ΒΆ
Legacy release-note table rows become at-release snapshots.
- tests.test_virustotal.test_records_from_release_notes_skips_rows_without_detections()[source]ΒΆ
Link-only and pending rows carry no snapshot to recover.
- tests.test_virustotal.test_records_from_release_notes_plain_body()[source]ΒΆ
Notes without a VirusTotal table yield nothing.
- tests.test_virustotal.test_load_scan_records_missing_file(tmp_path)[source]ΒΆ
A missing history file loads as an empty list.
- tests.test_virustotal.test_load_scan_records_malformed(tmp_path)[source]ΒΆ
A corrupt history file raises instead of being silently clobbered.
- tests.test_virustotal.test_upsert_scan_records_creates_file(tmp_path, sample_records)[source]ΒΆ
The history file and its parent directories are created on demand.
- tests.test_virustotal.test_upsert_scan_records_empty_creates_file(tmp_path)[source]ΒΆ
No new records still normalizes an empty history file into existence.
A header-only CSV is what later pipeline steps can rely on the presence of, and what
read_csvdistinguishes from a truncated file.
- tests.test_virustotal.test_upsert_scan_records_idempotent(tmp_path, sample_records)[source]ΒΆ
Re-upserting the same records reports no change.
- tests.test_virustotal.test_upsert_scan_records_replaces_same_day(tmp_path, sample_records)[source]ΒΆ
A record with the same (sha256, scanned) identity is replaced.
- tests.test_virustotal.test_upsert_scan_records_sorted_by_release_version(tmp_path)[source]ΒΆ
Records are ordered by release version, one line each.
Sorting on the parsed version rather than on the tag string is what keeps
v9beforev10, and one line per record is what keeps a releaseβs append readable in a diff.
- tests.test_virustotal.test_poll_detection_stats()[source]ΒΆ
Poll returns enriched results when analysis is complete.
- tests.test_virustotal.test_poll_detection_stats_timeout()[source]ΒΆ
Polling timeout produces results with None detection_stats.
- tests.test_virustotal.test_poll_detection_stats_empty()[source]ΒΆ
Polling with no results returns empty list.
- tests.test_virustotal.test_download_release_binaries_waits_for_the_asset_list(mock_gh, mock_sleep, tmp_path)[source]ΒΆ
The download starts once the release lists an asset, not before.
- tests.test_virustotal.test_download_release_binaries_retries_a_failed_read(mock_gh, mock_sleep, tmp_path)[source]ΒΆ
A read that fails is retried like one that lists no asset.
- tests.test_virustotal.test_download_release_binaries_downloads_after_the_last_empty_read(mock_gh, mock_sleep, tmp_path)[source]ΒΆ
An asset list that stays empty leaves the verdict to the download.
No wait follows the last read: the download runs at once, and its own failure is what reports a release that ships no binary.