~ar-python-hackers/authentication-results-python/trunk

« back to all changes in this revision

Viewing changes to authres/tests

  • Committer: Scott Kitterman
  • Date: 2016-12-11 05:52:42 UTC
  • Revision ID: scott@kitterman.com-20161211055242-molq08jlvoa07tj0
  + Add support for RFC 7601 use of SMTP auth with the mailfrom property

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""
19
19
Package for parsing ``Authentication-Results`` headers as defined in RFC 5451.
20
20
Optional support for authentication methods defined in RFCs 5617, 6008, 6212,
21
 
7489 and draft-ietf-dmarc-arc-protocol-05.
 
21
and draft-kucherawy-dmarc-base-01.
22
22
>>> import authres
23
23
>>> str(authres.AuthenticationResultsHeader('test.example.org', version=1))
24
24
'Authentication-Results: test.example.org 1; none'
422
422
>>> str(arobj.results[1].properties[1].value)
423
423
'voucher.example.org'
424
424
 
425
 
# RFC 7489 DMARC example from opendmarc
 
425
# draft-kucherawy-dmarc-base-01 example from opendmarc
426
426
>>> import authres
427
427
>>> import authres.dmarc
428
428
>>> new_context = authres.FeatureContext(authres.dmarc)
525
525
... results = [mfrom_pass, helo_none]))
526
526
'Authentication-Results: example.com; spf=pass smtp.mailfrom=authenticated@example.net; spf=none reason="No SPF record for HELO" smtp.helo=mailserver.example.net'
527
527
 
528
 
# Create header field with ARC results (draft-ietf-dmarc-arc-protocol-05)
529
 
>>> import authres
530
 
>>> import authres.arc
531
 
>>> arc_pass = authres.arc.ARCAuthenticationResult(result = 'pass',
532
 
... header_ams_d = 'example.net', header_ams_s='valimail2016', header_as_d="example.com", header_as_s="valimail2017")
533
 
>>> str(authres.AuthenticationResultsHeader(authserv_id = 'example.com',
534
 
... results = [arc_pass]))
535
 
'Authentication-Results: example.com; arc=pass header.ams-d=example.net header.ams-s=valimail2016 header.as-d=example.com header.as-s=valimail2017'
536
 
 
537
528
# Parsing IP6 address.
538
529
>>> arobj = authres_context.parse('Authentication-Results: mail.bmsi.com; iprev=pass policy.iprev="2001:748:100:40::2:2" (mout0.freenet.de); spf=none smtp.mailfrom=markuslaudi@freenet.de')
539
530
>>> str(arobj.results[0])