  
      Hide some test client ickyness where the header can be unicode.
      """
      auth = request.META.get('HTTP_AUTHORIZATION', b'')
      if isinstance(auth, text_type):
          # Work around django test client oddness
          auth = auth.encode(HTTP_HEADER_ENCODING)
      return auth
  
  
 
</s> remove class ForcedAuthentication(object):
 </s> add class ForcedAuthentication: </s> remove         class MockUser(object):
 </s> add         class MockUser: </s> remove         self.assertEqual(six.text_type(APIException()), 'Une erreur du serveur est survenue.')
 </s> add         self.assertEqual(str(APIException()), 'Une erreur du serveur est survenue.') </s> remove         self.assertEqual(resp.content, six.b(''))
 </s> add         self.assertEqual(resp.content, b'') </s> remove         self.assertEqual(resp.content, six.b(''))
 </s> add         self.assertEqual(resp.content, b'')
    if isinstance(auth, str):
  
      Hide some test client ickyness where the header can be unicode.
      """
      auth = request.META.get('HTTP_AUTHORIZATION', b'')
    if isinstance(auth, str):
          # Work around django test client oddness
          auth = auth.encode(HTTP_HEADER_ENCODING)
      return auth
  
  
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
rest_framework/authentication.py