Esempio n. 1
0
 def testUA(self, ua):
     request = DummyRequest(ua)
     MiniDetectorMiddleware.process_request(request)
     if self.expected:
         self.assert_(request.is_mobile,
                      "Mobile Not Detected: %s" % ua)
     else:
         self.assert_(not request.is_mobile,
                      "Mobile Falsely Detected: %s" % ua)
Esempio n. 2
0
 def test_wap(self):
     request = DummyRequest("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051019 Flock/0.4 Firefox/1.0+")
     request.META['HTTP_ACCEPT'] = 'application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, image/jpg, image/jpeg, image/png'        
     MiniDetectorMiddleware.process_request(request)
     self.assertTrue(request.is_wap, "WAP not Detected")
     
     request.META['HTTP_ACCEPT'] = 'application/xhtml+xml, text/html, application/vnd.wap.xhtml+xml, image/jpg, image/jpeg, image/png'        
     MiniDetectorMiddleware.process_request(request)
     self.assertFalse(request.is_wap, "WAP Detected")
     
     request.META['HTTP_ACCEPT'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
     MiniDetectorMiddleware.process_request(request)
     self.assertFalse(request.is_wap, "WAP Detected")        
Esempio n. 3
0
 def test_opera_mini(self):
     request = DummyRequest("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051019 Flock/0.4 Firefox/1.0+")
     request.META['HTTP_X_OPERAMINI_FEATURES'] = 'secure'
     MiniDetectorMiddleware.process_request(request)
     self.assert_(request.is_mobile, "Opera Mini not Detected")