title: Django tests - simulate that user is logged in
body: <p>In my tests I have a following bit of code:</p>
  
  <pre><code>def setUp(self):
      self.client.defaults['HTTP_AUTHORIZATION'] = 'Basic ' + base64.b64encode(
          '{username}:{password}'.format(**self.login_data)
      )
  
  def test_list_view(self):
      response = self.client.get(reverse('data_list'))
      self.assertEqual(response.status_code, 200)
  </code></pre>
  
  <p>My problem is that this check has to go through basic http authentication which uses ldap and it's pretty slow. </p>
  
  <p>Is there a way I can simulate that user is logged in?</p>