示例#1
0
 def test_serve_static_file_serves_mp3(self):
     request = HttpRequest()
     file_path = self.audio.local_path_mp3
     response = serve_static_file(request, file_path=self.good_mp3_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'audio/mpeg')
     self.assertIn('inline;', response['Content-Disposition'])
示例#2
0
 def test_serve_static_file_serves_txt(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_txt_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response["Content-Type"], "text/plain")
     self.assertIn("inline;", response["Content-Disposition"])
     self.assertIn("FOR THE DISTRICT OF COLUMBIA CIRCUIT", response.content)
示例#3
0
 def test_serve_static_file_serves_txt(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_txt_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'text/plain')
     self.assertIn('attachment;', response['Content-Disposition'])
     self.assertIn('FOR THE DISTRICT OF COLUMBIA CIRCUIT', response.content)
示例#4
0
 def test_serve_static_file_serves_mp3(self):
     request = HttpRequest()
     file_path = self.audio.local_path_mp3
     response = serve_static_file(request, file_path=self.good_mp3_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response["Content-Type"], "audio/mpeg")
     self.assertIn("inline;", response["Content-Disposition"])
示例#5
0
 def test_serve_static_file_serves_mp3(self):
     request = HttpRequest()
     file_path = self.audio.local_path_mp3
     response = serve_static_file(request, file_path=self.good_mp3_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'audio/mpeg')
     self.assertIn('inline;', response['Content-Disposition'])
示例#6
0
 def test_serve_static_file_serves_txt(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_txt_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'text/plain')
     self.assertIn('inline;', response['Content-Disposition'])
     self.assertIn(
         'FOR THE DISTRICT OF COLUMBIA CIRCUIT',
         response.content
     )
示例#7
0
 def test_serve_static_file_serves_pdf(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_pdf_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'application/pdf')
     self.assertIn('inline;', response['Content-Disposition'])
示例#8
0
 def test_serve_static_file_serves_pdf(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_pdf_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response["Content-Type"], "application/pdf")
     self.assertIn("inline;", response["Content-Disposition"])
示例#9
0
 def test_serve_static_file_serves_pdf(self):
     request = HttpRequest()
     response = serve_static_file(request, file_path=self.good_pdf_path)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response['Content-Type'], 'application/pdf')
     self.assertIn('inline;', response['Content-Disposition'])