1- import shutil , errno , pytest , json , gzip , os , re
1+ import shutil , errno , pytest , json , gzip , mimetypes , os , re
22
33from roundup import i18n
44from roundup import password
@@ -48,7 +48,9 @@ class WsgiSetup(LiveServerTestCase):
4848
4949 dirname = '_test_instance'
5050 backend = 'anydbm'
51-
51+
52+ js_mime_type = mimetypes .guess_type ("utils.js" )[0 ]
53+
5254 @classmethod
5355 def setup_class (cls ):
5456 '''All tests in this class use the same roundup instance.
@@ -527,7 +529,7 @@ def test_ims(self):
527529 print (f .headers )
528530
529531 self .assertEqual (f .status_code , 200 )
530- expected = { 'Content-Type' : 'application/javascript' ,
532+ expected = { 'Content-Type' : self . js_mime_type ,
531533 'Content-Encoding' : 'gzip' ,
532534 'Vary' : 'Accept-Encoding' ,
533535 }
@@ -586,7 +588,7 @@ def test_compression_gzipfile(self):
586588 print (f .headers )
587589
588590 self .assertEqual (f .status_code , 200 )
589- expected = { 'Content-Type' : 'application/javascript' ,
591+ expected = { 'Content-Type' : self . js_mime_type ,
590592 'Content-Encoding' : 'gzip' ,
591593 'Vary' : 'Accept-Encoding' ,
592594 'Content-Length' : '69' ,
@@ -612,7 +614,7 @@ def test_compression_gzipfile(self):
612614 print(f.headers)
613615
614616 self.assertEqual(f.status_code, 200)
615- expected = { 'Content-Type': 'application/javascript' ,
617+ expected = { 'Content-Type': self.js_mime_type ,
616618 'Content-Encoding': 'br',
617619 'Vary': 'Accept-Encoding',
618620 'Content-Length': '960',
@@ -646,7 +648,7 @@ def test_compression_gzipfile(self):
646648 print (f .headers )
647649
648650 self .assertEqual (f .status_code , 200 )
649- expected = { 'Content-Type' : 'application/javascript' ,
651+ expected = { 'Content-Type' : self . js_mime_type ,
650652 'Content-Encoding' : 'gzip' ,
651653 'Vary' : 'Accept-Encoding' ,
652654 }
@@ -824,7 +826,7 @@ def test_compression_gzip(self, method='gzip'):
824826 print (f .headers )
825827
826828 self .assertEqual (f .status_code , 200 )
827- expected = { 'Content-Type' : 'application/javascript' ,
829+ expected = { 'Content-Type' : self . js_mime_type ,
828830 'Content-Encoding' : method ,
829831 'Vary' : 'Accept-Encoding' ,
830832 }
0 commit comments