First commit

This commit is contained in:
Sean Whalen
2018-02-05 20:23:07 -05:00
commit 6b9e36ed77
17 changed files with 1738 additions and 0 deletions

24
tests.py Normal file
View File

@@ -0,0 +1,24 @@
from __future__ import print_function, unicode_literals, absolute_import
import unittest
from glob import glob
import json
import parsedmarc
class Test(unittest.TestCase):
def testSamples(self):
"""Test sample aggregate DMARC reports"""
sample_paths = glob("samples/*.sample")
for sample_path in sample_paths:
print("Testing {0}...\n".format(sample_path))
parsed_report = parsedmarc.parse_aggregate_report_file(sample_path)
print(json.dumps(parsed_report, ensure_ascii=False, indent=2))
print("\n")
print(parsedmarc.parsed_aggregate_report_to_csv(parsed_report))
if __name__ == "__main__":
suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=2).run(suite)