mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-02-17 07:03:58 +00:00
Expand test coverage
This commit is contained in:
@@ -25,8 +25,7 @@ script:
|
||||
- "cd docs"
|
||||
- "make html"
|
||||
- "cd .."
|
||||
- "python tests.py"
|
||||
- "coverage run tests.py"
|
||||
- "coverage run tests.py"
|
||||
- "python setup.py install"
|
||||
- "parsedmarc -c ci.ini samples/aggregate/*"
|
||||
- "parsedmarc -c ci.ini samples/forensic/*"
|
||||
|
||||
19
tests.py
19
tests.py
@@ -5,9 +5,28 @@ from glob import glob
|
||||
import json
|
||||
|
||||
import parsedmarc
|
||||
import parsedmarc.utils
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
def testBase64Decoding(self):
|
||||
"""Test base64 decoding"""
|
||||
# Example from Wikipedia Base64 article
|
||||
b64_str = "YW55IGNhcm5hbCBwbGVhcw"
|
||||
decoded_str = parsedmarc.utils.decode_base64(b64_str)
|
||||
assert decoded_str == b"any carnal pleas"
|
||||
|
||||
def testPSLDownload(self):
|
||||
subdomain = "foo.example.com"
|
||||
result = parsedmarc.utils.get_base_domain(subdomain,
|
||||
use_fresh_psl=True)
|
||||
assert result == "example.com"
|
||||
|
||||
# Test PSL caching
|
||||
result = parsedmarc.utils.get_base_domain(subdomain,
|
||||
use_fresh_psl=True)
|
||||
assert result == "example.com"
|
||||
|
||||
def testAggregateSamples(self):
|
||||
"""Test sample aggregate/rua DMARC reports"""
|
||||
sample_paths = glob("samples/aggregate/*")
|
||||
|
||||
Reference in New Issue
Block a user