def testInvalidBasicAuthStringResponse(self):

        # Test missing "Basic" opening keyword
        request = HttpRequest()
        request.META['Authorization'] = 'invalid_basic_auth_string'

        self.assertFalse(self.api._perform_basic_auth(request))

        # Test wrong formatting of credentials
        request = HttpRequest()
        credentials = 'username password'.encode('base64') # Missing colon separator
        request.META['Authorization'] = 'Basic %s' % credentials

        self.assertFalse(self.api._perform_basic_auth(request))
Ensure that invalid basic auth headers are treated correctly.
dataset/ETHPy150Open funkbit/django-dynamicresponse/examples/myblog/blog/tests/api.py/ApiTest.testInvalidBasicAuthStringResponse