def test_log_auth_inactive_user(self):
        # set up inactive user with token
        user = User.objects.create_user(username='myname', password='secret')
        token = Token.objects.create(user=user)
        token_header = 'Token %s' % token.key
        user.is_active = False
        user.save()

        # force login because regular client.login doesn't work for inactive users
        self.client.get('/token-auth-logging',
                        HTTP_AUTHORIZATION=token_header)

        # test
        log = APIRequestLog.objects.first()
        self.assertIsNone(log.user)
        self.assertIn("User inactive or deleted", log.response)
dataset/ETHPy150Open aschn/drf-tracking/tests/test_mixins.py/TestLoggingMixin.test_log_auth_inactive_user/original