Skip to content

Commit 6e0fbf5

Browse files
committed
Add rule label to disposition
1 parent a4f45a0 commit 6e0fbf5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

minfraud/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,16 +430,26 @@ class Disposition:
430430
"custom_rule", "block_list", and "default". If you do not have custom
431431
rules set up, ``None`` will be returned.
432432
433+
:type: str | None
434+
435+
.. attribute:: rule_label
436+
437+
The label of the custom rule that was triggered. If you do not have
438+
custom rule set up, or the custom rule that was triggered does not have a
439+
label, ``None`` will be returned.
440+
433441
:type: str | None
434442
"""
435443

436444
action: Optional[str]
437445
reason: Optional[str]
446+
rule_label: Optional[str]
438447

439448
__slots__ = ()
440449
_fields = {
441450
"action": None,
442451
"reason": None,
452+
"rule_label": None,
443453
}
444454

445455

tests/test_models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ def test_device(self):
9999
self.assertEqual(local_time, device.local_time)
100100

101101
def test_disposition(self):
102-
disposition = Disposition({"action": "accept", "reason": "default"})
102+
disposition = Disposition(
103+
{"action": "accept", "reason": "default", "rule_label": "custom rule label"}
104+
)
103105

104106
self.assertEqual("accept", disposition.action)
105107
self.assertEqual("default", disposition.reason)
108+
self.assertEqual("custom rule label", disposition.rule_label)
106109

107110
def test_email(self):
108111
first_seen = "2016-01-01"

0 commit comments

Comments
 (0)