<s> from django . core . exceptions import ImproperlyConfigured <EOL> from django . conf import settings <EOL> from django . core . mail import EmailMessage <EOL> from django_mailgun import MailgunBackend <EOL> from pytest import raises <EOL> def test_no_configuration ( ) : <EOL> with raises ( ImproperlyConfigured ) : <EOL> MailgunBackend ( ) <EOL> def test_configuration ( ) : <EOL> settings . configure ( <EOL> MAILGUN_ACCESS_KEY = <NUM_LIT> , <EOL> MAILGUN_SERVER_NAME = '<STR_LIT:abc>' <EOL> ) <EOL> MailgunBackend ( ) <EOL> def test_marker_methods ( ) : <EOL> mb = MailgunBackend ( ) <EOL> assert mb . open ( ) is None <EOL> assert mb . close ( ) is None <EOL> def setUp ( ) : <EOL> mb = MailgunBackend ( fail_silently = True ) <EOL> message = EmailMessage ( ) <EOL> return ( mb , message ) <EOL> def check_output_value ( mb , message , test_input , expected_output ) : <EOL> for k , v in test_input . iteritems ( ) : <EOL> message . extra_headers [ k ] = v <EOL> output = mb . _map_smtp_headers_to_api_parameters ( message ) <EOL> for extra_header in expected_output : <EOL> assert extra_header in output <EOL> def test_extra_headers_map ( ) : <EOL> mb , message = setUp ( ) <EOL> test_input = { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : "<STR_LIT:1>" , <EOL> '<STR_LIT>' : '<STR_LIT:yes>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:yes>' , <EOL> '<STR_LIT>' : '<STR_LIT:yes>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> expected_output = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:1>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:yes>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:yes>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:yes>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] <EOL> check_output_value ( mb , message , test_input , expected_output ) </s>
