From 66d93bf7a7b9f9053ffeac7ce7c939a5f3f74008 Mon Sep 17 00:00:00 2001 From: Tommy Beadle Date: Tue, 15 Oct 2024 12:06:46 -0400 Subject: [PATCH] Fix test where the `file` utility changes its output based on the installed version. --- tests/test_objects.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/test_objects.py b/tests/test_objects.py index 45af7ea7b06..d6859890375 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -223,9 +223,14 @@ def test_get_type(self, test_files): [ ("temp_pe32", "PE32 executable (GUI) Intel 80386, for MS Windows", True), # emulated magic type ("temp_pe64", "PE32+ executable (GUI) x86-64, for MS Windows", True), # emulated magic type - # Broken we remove "MS-DOS executable" - # ("temp_pe_aarch64", "MS-DOS executable PE32 executable Aarch64, for MS Windows", True), - ("temp_pe_aarch64", "PE32 executable Aarch64, for MS Windows", True), + ( + "temp_pe_aarch64", + ( + "PE32 executable Aarch64, for MS Windows", + "MS-DOS executable PE32 executable Aarch64, for MS Windows", + ), + True, + ), ("temp_elf32", "ELF 32-bit LSB", False), ("temp_elf64", "ELF 64-bit LSB", False), ("temp_macho_arm64", "Mach-O 64-bit arm64 executable", False), @@ -234,7 +239,9 @@ def test_get_type(self, test_files): def test_get_type_pe(self, file_fixture, expected, is_pe, request): path = request.getfixturevalue(file_fixture) file = File(path) - assert file.get_type() == expected + if isinstance(expected, str): + expected = (expected,) + assert file.get_type() in expected assert bool(file.pe) == is_pe def test_get_yara(self, hello_file, yara_compiled):