mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-03-26 16:32:48 +00:00
Make pct and fo default to None when not provided (DMARCbis reports)
Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
This commit is contained in:
committed by
Sean Whalen
parent
246979a855
commit
cdb56904d3
@@ -810,12 +810,12 @@ def parse_aggregate_report_xml(
|
||||
if policy_published["sp"] is not None:
|
||||
sp = policy_published["sp"]
|
||||
new_policy_published["sp"] = sp
|
||||
pct = "100"
|
||||
pct = None
|
||||
if "pct" in policy_published:
|
||||
if policy_published["pct"] is not None:
|
||||
pct = policy_published["pct"]
|
||||
new_policy_published["pct"] = pct
|
||||
fo = "0"
|
||||
fo = None
|
||||
if "fo" in policy_published:
|
||||
if policy_published["fo"] is not None:
|
||||
fo = policy_published["fo"]
|
||||
|
||||
7
tests.py
7
tests.py
@@ -271,11 +271,12 @@ class Test(unittest.TestCase):
|
||||
self.assertEqual(pp["np"], "none")
|
||||
self.assertEqual(pp["testing"], "n")
|
||||
self.assertEqual(pp["discovery_method"], "treewalk")
|
||||
# adkim/aspf/pct/fo default when not in XML
|
||||
# adkim/aspf default when not in XML
|
||||
self.assertEqual(pp["adkim"], "r")
|
||||
self.assertEqual(pp["aspf"], "r")
|
||||
self.assertEqual(pp["pct"], "100")
|
||||
self.assertEqual(pp["fo"], "0")
|
||||
# pct/fo are None on DMARCbis reports (not used)
|
||||
self.assertIsNone(pp["pct"])
|
||||
self.assertIsNone(pp["fo"])
|
||||
|
||||
# Verify record
|
||||
self.assertEqual(len(report["records"]), 1)
|
||||
|
||||
Reference in New Issue
Block a user