<s> """<STR_LIT>""" <EOL> from django . http import Http404 <EOL> import django . test <EOL> from django_downloadview . response import DownloadResponse <EOL> from django_downloadview . shortcuts import sendfile <EOL> class SendfileTestCase ( django . test . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_defaults ( self ) : <EOL> """<STR_LIT>""" <EOL> request = django . test . RequestFactory ( ) . get ( '<STR_LIT>' ) <EOL> filename = __file__ <EOL> response = sendfile ( request , filename ) <EOL> self . assertTrue ( isinstance ( response , DownloadResponse ) ) <EOL> self . assertFalse ( response . attachment ) <EOL> def test_custom ( self ) : <EOL> """<STR_LIT>""" <EOL> request = django . test . RequestFactory ( ) . get ( '<STR_LIT>' ) <EOL> filename = __file__ <EOL> response = sendfile ( request , <EOL> filename , <EOL> attachment = True , <EOL> attachment_filename = '<STR_LIT>' , <EOL> mimetype = '<STR_LIT>' , <EOL> encoding = '<STR_LIT>' ) <EOL> self . assertTrue ( isinstance ( response , DownloadResponse ) ) <EOL> self . assertTrue ( response . attachment ) <EOL> self . assertEqual ( response . basename , '<STR_LIT>' ) <EOL> self . assertEqual ( response [ '<STR_LIT:Content-Type>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( response . get_encoding ( ) , '<STR_LIT>' ) <EOL> def test_404 ( self ) : <EOL> """<STR_LIT>""" <EOL> request = django . test . RequestFactory ( ) . get ( '<STR_LIT>' ) <EOL> filename = '<STR_LIT>' <EOL> with self . assertRaises ( Http404 ) : <EOL> sendfile ( request , filename ) </s>
