def METHOD_NAME(self):
    self.prepare_data(-10)
    @require_oauth('profile')
    def get_user_profile(request):
        user = request.oauth_token.user
        return JsonResponse(dict(sub=user.pk, username=user.username))
    request = self.factory.get('/user', HTTP_AUTHORIZATION='bearer a1')
    resp = get_user_profile(request)
    self.assertEqual(resp.status_code, 401)
    data = json.loads(resp.content)
    self.assertEqual(data['error'], 'invalid_token')