tests: assert absence of the wrong os/format

This commit is contained in:
William Ballenthin
2021-08-11 09:13:56 -06:00
parent 20859d2796
commit 97092c91db
2 changed files with 8 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ import capa.engine
import capa.features.common
from capa.features.file import FunctionName
from capa.features.insn import Number, Offset
from capa.features.common import ARCH_X32, ARCH_X64, OS_WINDOWS, FORMAT_PE, String, Characteristic
from capa.features.common import ARCH_X32, ARCH_X64, CHARACTERISTIC_PE, CHARACTERISTIC_WINDOWS, OS_WINDOWS, FORMAT_PE, String, Characteristic
def test_rule_ctor():
@@ -960,7 +960,8 @@ def test_os_features():
)
r = capa.rules.Rule.from_yaml(rule)
children = list(r.statement.get_children())
assert (Characteristic(OS_WINDOWS) in children) == True
assert (CHARACTERISTIC_WINDOWS in children) == True
assert (CHARACTERISTIC_LINUX not in children) == True
def test_format_features():
@@ -977,4 +978,5 @@ def test_format_features():
)
r = capa.rules.Rule.from_yaml(rule)
children = list(r.statement.get_children())
assert (Characteristic(FORMAT_PE) in children) == True
assert (CHARACTERISTIC_PE in children) == True
assert (CHARACTERISTIC_ELF not in children) == True