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_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), {}))
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)
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), {}))