Exemple #1
0
 def test_desktop_browser_agent(self, set_flavour):
     request = Mock()
     request.META = {
         'HTTP_USER_AGENT': 'My Desktop Browser',
     }
     middleware = MobileDetectionMiddleware()
     middleware.process_request(request)
     self.assertEqual(set_flavour.call_args, (('full', request), {}))
 def test_desktop_browser_agent(self, set_flavour):
     request = Mock()
     request.META = {
         'HTTP_USER_AGENT': 'My Desktop Browser',
     }
     middleware = MobileDetectionMiddleware()
     middleware.process_request(request)
     self.assertEqual(set_flavour.call_args, (('full', request), {}))
Exemple #3
0
 def test_mobile_browser_agent(self, set_flavour):
     request = Mock()
     request.META = {
         "HTTP_USER_AGENT": "My Mobile Browser",
     }
     middleware = MobileDetectionMiddleware()
     middleware.process_request(request)
     self.assertEqual(set_flavour.call_args, (("mobile", request), {}))
Exemple #4
0
 def test_desktop_browser_agent(self, set_flavour):
     request = Mock()
     request.META = {"HTTP_USER_AGENT": "My Desktop Browser"}
     middleware = MobileDetectionMiddleware()
     middleware.process_request(request)
     self.assertEqual(set_flavour.call_count, 0)
Exemple #5
0
 def test_mobile_browser_agent(self, set_flavour):
     request = Mock()
     request.META = {"HTTP_USER_AGENT": "My Mobile Browser"}
     middleware = MobileDetectionMiddleware()
     middleware.process_request(request)
     self.assertEqual(set_flavour.call_args, (("mobile", request), {}))