Пример #1
0
def InitHttp(api_endpoint=None, page_size=None, auth=None):
    """Inits an GRR API object with a HTTP connector."""

    connector = http_connector.HttpConnector(api_endpoint=api_endpoint,
                                             page_size=page_size,
                                             auth=auth)

    return GrrApi(connector=connector)
Пример #2
0
  def setUpClass(cls):  # pylint: disable=invalid-name
    if cls.api_version not in [1, 2]:
      raise ValueError("api_version may be 1 or 2 only")

    if not HttpApiRegressionTestMixinBase._connector:
      port = portpicker.PickUnusedPort()
      logging.info("Picked free AdminUI port %d.", port)

      testing_startup.TestInit()
      # Force creation of new APIAuthorizationManager.
      api_auth_manager.APIACLInit.InitApiAuthManager()

      trd = django_lib.DjangoThread(port)
      trd.StartAndWaitUntilServing()

      endpoint = ("http://localhost:%s" % port)
      HttpApiRegressionTestMixinBase._connector = http_connector.HttpConnector(
          api_endpoint=endpoint)
Пример #3
0
 def setUp(self):  # pylint: disable=invalid-name
     super(HttpApiRegressionTestMixinBase, self).setUp()
     self.connector = http_connector.HttpConnector(
         api_endpoint=self.__class__.endpoint)