code: def test_add_resource_endpoint(self, app, mocker):
      view = mocker.Mock(
          **{"as_view.return_value.__name__": str("test_view")}
      )
  
      api = restplus.Api(app)
      api.add_resource(view, "/foo", endpoint="bar")
  
      view.as_view.assert_called_with("bar", api)
  
imports: from __future__ import unicode_literals
  import flask
  import pytest
  import six
  from json import dumps, JSONEncoder
  from flask import Blueprint, redirect, views
  from werkzeug.exceptions import HTTPException, Unauthorized, BadRequest
  import flask_restplus
label_desc: Use image node_id 17 for calling the APITest obj's underlying member method code with example usage: obj.test_add_resource_endpoint(app, mocker) without return types