Пример #1
0
 def test_process_request(self):
     """
     if ThreadLocalMiddleware is enabled in settings, then running the test client
     should trigger the middleware and set the request in thread locals
     """
     client = Client()
     client.get(u'/')
     self.assertEqual(get_current_request().path, u'/')
Пример #2
0
 def test_get_current_request(self):
     self.assertEqual(get_current_request(), None)  # tests default (None)
     request = RequestFactory().get(u'/')
     set_thread_variable('request', request)
     self.assertEqual(get_current_request(), request)