예제 #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), {}))
예제 #2
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), {}))
예제 #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), {}))
예제 #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)
예제 #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), {}))