mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-02-17 07:03:58 +00:00
First commit
This commit is contained in:
24
tests.py
Normal file
24
tests.py
Normal 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)
|
||||
Reference in New Issue
Block a user