style: apply ruff formatting to tests/test_rules.py
Some checks failed
CI / lint-and-test (push) Failing after 24s
Some checks failed
CI / lint-and-test (push) Failing after 24s
This commit is contained in:
@@ -5,6 +5,7 @@ def test_matches_equals():
|
|||||||
rule = {"conditions": [{"field": "operation", "op": "eq", "value": "Add user"}]}
|
rule = {"conditions": [{"field": "operation", "op": "eq", "value": "Add user"}]}
|
||||||
event = {"operation": "Add user", "timestamp": datetime.now(UTC).isoformat()}
|
event = {"operation": "Add user", "timestamp": datetime.now(UTC).isoformat()}
|
||||||
from rules import _matches
|
from rules import _matches
|
||||||
|
|
||||||
assert _matches(rule, event) is True
|
assert _matches(rule, event) is True
|
||||||
|
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ def test_matches_not_equals():
|
|||||||
rule = {"conditions": [{"field": "operation", "op": "neq", "value": "Delete user"}]}
|
rule = {"conditions": [{"field": "operation", "op": "neq", "value": "Delete user"}]}
|
||||||
event = {"operation": "Add user", "timestamp": datetime.now(UTC).isoformat()}
|
event = {"operation": "Add user", "timestamp": datetime.now(UTC).isoformat()}
|
||||||
from rules import _matches
|
from rules import _matches
|
||||||
|
|
||||||
assert _matches(rule, event) is True
|
assert _matches(rule, event) is True
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +21,7 @@ def test_matches_contains():
|
|||||||
rule = {"conditions": [{"field": "actor_display", "op": "contains", "value": "Admin"}]}
|
rule = {"conditions": [{"field": "actor_display", "op": "contains", "value": "Admin"}]}
|
||||||
event = {"actor_display": "Admin (admin@example.com)", "timestamp": datetime.now(UTC).isoformat()}
|
event = {"actor_display": "Admin (admin@example.com)", "timestamp": datetime.now(UTC).isoformat()}
|
||||||
from rules import _matches
|
from rules import _matches
|
||||||
|
|
||||||
assert _matches(rule, event) is True
|
assert _matches(rule, event) is True
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +29,7 @@ def test_matches_after_hours():
|
|||||||
rule = {"conditions": [{"field": "timestamp", "op": "after_hours", "value": None}]}
|
rule = {"conditions": [{"field": "timestamp", "op": "after_hours", "value": None}]}
|
||||||
event = {"timestamp": "2024-01-01T22:00:00Z"}
|
event = {"timestamp": "2024-01-01T22:00:00Z"}
|
||||||
from rules import _matches
|
from rules import _matches
|
||||||
|
|
||||||
assert _matches(rule, event) is True
|
assert _matches(rule, event) is True
|
||||||
|
|
||||||
event2 = {"timestamp": "2024-01-01T10:00:00Z"}
|
event2 = {"timestamp": "2024-01-01T10:00:00Z"}
|
||||||
|
|||||||
Reference in New Issue
Block a user