import pytest from QutteraWebsiteMalwareScanner import report_malware, rescan_status, scan_report, scan_start, status_blacklist SERVER_URL = "scannerapi.quttera.com" HTTPS_BASE = f"https://{SERVER_URL}/api/v3" class ResponseMock: start_scan = {"error": 200, "errorstr": "success"} rescan_status = { "error": 200, "errorstr": "success", "status": { "blacklisted": "no", "files": 12, "scanner_result": "undef", "sensitivity": "HEURISTIC", "state": "SCAN", "time": 1653420189, "url": "domain.test", }, } scan_report_clean = { "error": 200, "errorstr": "success", "status": { "blacklisted": "no", "files": 16, "scanner_result": "clean", "sensitivity": "HEURISTIC", "state": "DONE", "time": 1670147717, "url": "domain.test", }, } scan_report_in_progress = { "error": 200, "errorstr": "success", "status": { "blacklisted": "no", "files": 16, "scanner_result": "clean", "sensitivity": "HEURISTIC", "state": "DOWNLOAD", "time": 1670147717, "url": "domain.test", }, } status_blacklist = {"error": 200, "errorstr": "success", "status": {"blacklisted": "no", "url": "domain.test"}} report_malware = { "error": 200, "errorstr": "success", "report": { "blacklist_report": { "blacklist_status": "NoThreat", "providers": [ {"name": "Google", "status": "NoThreat", "time": "1511222759"}, {"name": "Google", "status": "NoThreat", "time": "1511222759"}, {"name": "MalwareDomainList", "status": "NoThreat", "time": "1511222759"}, {"name": "ZeusTracker", "status": "NoThreat", "time": "1511222759"}, ], }, "blacklisted_domains": {}, "blacklisted_domains_count": 0, "blacklisted_iframes": {}, "blacklisted_iframes_count": 0, "blacklisted_links": {}, "blacklisted_links_count": 0, "domains": {"adssettings.google.com": "NoThreat", "domain.test": "NoThreat", "youtu.be": "NoThreat"}, "domains_count": 2, "files": [ { "MD5": "18912736AD1E68285BBD6087610FDBF7", "_severity": "clean", "details": "File is clean.", "dumpMD5": "00000000000000000000000000000000", "endtime": "Sun Dec 4 11:18:29 2022", "filename": "domain.test/website-anti-malware-monitoring", "filesize": "91356", "filetype": "HTML", "layer": "js-emulation-layer", "line": "0", "offset": "0", "pattern_id": "N/A", "reason": "No significant issues detected.", "result": "1", "scantime": "5.820000", "threat": "Clean", "threat_name": "Undefined", }, { "MD5": "91274D3E5EB68C1BABBD22B55C416698", "_severity": "clean", "details": "File is clean.", "dumpMD5": "00000000000000000000000000000000", "endtime": "Sun Dec 4 11:18:37 2022", "filename": "domain.test/affiliates", "filesize": "67062", "filetype": "HTML", "layer": "js-emulation-layer", "line": "0", "offset": "0", "pattern_id": "N/A", "reason": "No significant issues detected.", "result": "1", "scantime": "7.224000", "threat": "Clean", "threat_name": "Undefined", }, ], "http_timeout": 0.844234, "iframes": { '