'The anonymous cookie is set when the anonymous id is created.'

def test_cookie_set(self):

    request = self.rf.request()
    self.middleware.process_request(request)
    eq_(False, request.anonymous.has_id)
    anon_id = request.anonymous.anonymous_id
    eq_(True, request.anonymous.has_id)
    response = HttpResponse()
    response = self.middleware.process_response(request, response)
    eq_(True, (settings.ANONYMOUS_COOKIE_NAME in response.cookies))
    eq_(anon_id, response.cookies[settings.ANONYMOUS_COOKIE_NAME].value)
