'Calls SafeSessionMiddleware.process_response and verifies
the response, while expecting the cookie to be deleted if
expect_delete_called is True.
See assert_response for information on the other
parameters.'

def assert_response_with_delete_cookie(self, expect_delete_called=True, set_request_user=False, set_session_cookie=False):

    with patch('django.http.HttpResponse.set_cookie') as mock_delete_cookie:
        self.assert_response(set_request_user=set_request_user, set_session_cookie=set_session_cookie)
        self.assertEquals(mock_delete_cookie.called, expect_delete_called)
