~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:
603
603
>>> str(authres.AuthenticationResultsHeader(authserv_id='example.net',results = [rrvs_fail]))
604
604
"Authentication-Results: example.net; rrvs=fail (Mail box expired.) smtp.rrvs=user@example.com (These are not the droids you're looking for.)"
605
605
 
 
606
# New for RFC 7601 SMTP Auth Mail From
 
607
 
 
608
>>> import authres
 
609
>>> arobj = authres.AuthenticationResultsHeader.parse('Authentication-Results: example.com; auth=pass smtp.mailfrom=sender@example.net')
 
610
>>> str(arobj.authserv_id)
 
611
'example.com'
 
612
>>> str(arobj.results[0])
 
613
'auth=pass smtp.mailfrom=sender@example.net'
 
614
>>> str(arobj.results[0].method)
 
615
'auth'
 
616
>>> str(arobj.results[0].result)
 
617
'pass'
 
618
>>> str(arobj.results[0].smtp_mailfrom)
 
619
'sender@example.net'
 
620
>>> str(arobj.results[0].properties[0].type)
 
621
'smtp'
 
622
>>> str(arobj.results[0].properties[0].name)
 
623
'mailfrom'
 
624
>>> str(arobj.results[0].properties[0].value)
 
625
'sender@example.net'
 
626
 
 
627
# Create header field with RFC 7601 SMTP Auth Mail From
 
628
>>> import authres
 
629
>>> mfrom_auth = authres.SMTPAUTHAuthenticationResult(result = 'pass',
 
630
... smtp_mailfrom = 'mailauth@example.net')
 
631
>>> str(authres.AuthenticationResultsHeader(authserv_id = 'example.com',
 
632
... results = [mfrom_auth]))
 
633
'Authentication-Results: example.com; auth=pass smtp.mailfrom=mailauth@example.net'
 
634
 
606
635
# vim:sw=4 sts=4