Пример #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'])