Example #1
0
 def test_no_user_agent(self):
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #2
0
 def test_no_user_agent(self):
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #3
0
 def test_valid(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126 Safari/533.4"
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #4
0
 def test_valid(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126 Safari/533.4"
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #5
0
 def test_no_requirements_settings(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126 Safari/533.4"
     if hasattr(settings, "BADBROWSER_REQUIREMENTS"):
         del settings.BADBROWSER_REQUIREMENTS
     
     request = HttpRequest()
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #6
0
 def test_no_requirements_settings(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126 Safari/533.4"
     if hasattr(settings, "BADBROWSER_REQUIREMENTS"):
         del settings.BADBROWSER_REQUIREMENTS
     
     request = HttpRequest()
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     self.assertEqual(middleware.process_request(request), None)
Example #7
0
 def test_old_major_version_ignore(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/4.0.375.126 Safari/533.4"
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     request.COOKIES["badbrowser_ignore"] = True
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     response = middleware.process_request(request)
     self.assertEqual(response, None)
Example #8
0
 def test_old_major_version_ignore(self):
     ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/4.0.375.126 Safari/533.4"
     settings.BADBROWSER_REQUIREMENTS = (("Chrome", "5.0.175.126"),)
     
     request = HttpRequest()
     request.COOKIES["badbrowser_ignore"] = True
     request.META["HTTP_USER_AGENT"] = ua
     
     middleware = BrowserSupportDetection()
     response = middleware.process_request(request)
     self.assertEqual(response, None)