def test_returns_dict_with_use_mobile_equals_false_when_mobile_cookie_is_false(self):
        self.request.META = {'HTTP_USER_AGENT': 'android'}
        self.request.COOKIES = {get_mobile_cookie_name(): 'false'}

        context = detect_mobile(self.request)
        self.assertEqual({
            'use_mobile': False,
        }, context)
def render_mobile_response(request, cookie_value):
    response = HttpResponseRedirect(request.GET.get("next", "/"))
    response.set_cookie(get_mobile_cookie_name(), cookie_value)
    return response
 def test_returns_false_when_is_mobile_and_user_declined_mobile(self):
     self.request.COOKIES = {get_mobile_cookie_name(): 'false'}
     self.request.META = {'HTTP_USER_AGENT': 'android'}
     self.assertEqual(False, use_mobile(self.request))
 def test_returns_true_when_is_not_mobile_but_has_mobile_cookie(self):
     self.request.COOKIES = {get_mobile_cookie_name(): 'true'}
     self.request.META = {'HTTP_USER_AGENT': 'chrome'}
     self.assertEqual(True, use_mobile(self.request))
 def test_returns_false_when_user_has_mobile_cookie_true(self):
     self.request.COOKIES = {get_mobile_cookie_name(): 'true'}
     self.assertFalse(no_mobile_cookie(self.request))