def test_version_details_sys(): result = win_file.version_details(r"C:\Windows\System32\drivers\netio.sys") assert result["FileDescription"] == "Network I/O Subsystem" assert result["FileType"] == "Network Driver" assert result["OperatingSystem"] == ["32-bit Windows", "Windows NT"] regex = re.compile(r"\d+.\d+.\d+.\d+") assert regex.search(result["ProductVersion"]) assert regex.search(result["Version"])
def test_version_details_dll(): result = win_file.version_details(r"C:\Windows\System32\FirewallAPI.dll") assert "Firewall API" in result["FileDescription"] assert result["FileType"] == "DLL" assert result["OperatingSystem"] == ["32-bit Windows", "Windows NT"] regex = re.compile(r"\d+.\d+.\d+.\d+") assert regex.search(result["ProductVersion"]) assert regex.search(result["Version"])
def test_version_details_exe(): result = win_file.version_details(r"C:\Windows\notepad.exe") assert result["FileDescription"] == "Notepad" assert result["FileType"] == "Application" assert result["OperatingSystem"] == ["32-bit Windows", "Windows NT"] regex = re.compile(r"\d+.\d+.\d+.\d+") assert regex.search(result["ProductVersion"]) assert regex.search(result["Version"])
def test_version_details_missing_directory(): with pytest.raises(CommandExecutionError): win_file.version_details("C:\\Windows\\System32")
def test_version_details_missing_file(): with pytest.raises(CommandExecutionError): win_file.version_details("C:\\Windows\\bogus.exe")