def testProdEndpointCompatibleWithDefaultEndpoint(self):
    properties.VALUES.api_endpoint_overrides.testing.Set(None)
    properties.VALUES.api_endpoint_overrides.toolresults.Set(PROD_RESULTS)
    endpoints.ValidateTestServiceEndpoints()

    properties.VALUES.api_endpoint_overrides.testing.Set(PROD_TESTING)
    properties.VALUES.api_endpoint_overrides.toolresults.Set(None)
    endpoints.ValidateTestServiceEndpoints()
Esempio n. 2
0
    def Filter(self, context, args):
        """Modify the context that will be given to this group's commands when run.

    Args:
      context: {str:object}, The current context, which is a set of key-value
          pairs that can be used for common initialization among commands.
      args: argparse.Namespace: The same Namespace given to the corresponding
          .Run() invocation.

    Returns:
      The refined command context.
    """
        # Make sure service endpoints are compatible with each other.
        endpoints.ValidateTestServiceEndpoints()

        # Create the client for the Testing service.
        testing_client = apis.GetClientInstance('testing', 'v1')
        testing_client.num_retries = 9  # Add extra retries due to b/76429898.
        context['testing_client'] = testing_client
        context['testing_messages'] = apis.GetMessagesModule('testing', 'v1')

        # Create the client for the Tool Results service.
        context['toolresults_client'] = apis.GetClientInstance(
            'toolresults', 'v1beta3')
        context['toolresults_messages'] = apis.GetMessagesModule(
            'toolresults', 'v1beta3')

        # Create the client for the Storage service.
        context['storage_client'] = apis.GetClientInstance('storage', 'v1')

        return context
Esempio n. 3
0
    def Filter(self, context, args):
        """Modify the context that will be given to this group's commands when run.

    Args:
      context: {str:object}, The current context, which is a set of key-value
          pairs that can be used for common initialization among commands.
      args: argparse.Namespace: The same Namespace given to the corresponding
          .Run() invocation.

    Returns:
      The refined command context.
    """
        # Make sure service endpoints are compatible with each other.
        endpoints.ValidateTestServiceEndpoints()

        # Create the client for the Testing service.
        context['testing_client'] = apis.GetClientInstance('testing', 'v1')
        context['testing_messages'] = apis.GetMessagesModule('testing', 'v1')

        # Create the client for the Tool Results service.
        context['toolresults_client'] = apis.GetClientInstance(
            'toolresults', 'v1beta3')
        context['toolresults_messages'] = apis.GetMessagesModule(
            'toolresults', 'v1beta3')

        # Create the client for the Storage service.
        context['storage_client'] = apis.GetClientInstance('storage', 'v1')

        log.status.Print(
            '\nHave questions, feedback, or issues? Get support by '
            'visiting:\n  https://firebase.google.com/support/\n')

        return context
  def testProdEndpointIsIncompatibleWithTestEndpoint(self):
    properties.VALUES.api_endpoint_overrides.testing.Set(PROD_TESTING)
    properties.VALUES.api_endpoint_overrides.toolresults.Set(TEST_RESULTS)

    with self.assertRaises(exceptions.IncompatibleApiEndpointsError) as ex_ctx:
      endpoints.ValidateTestServiceEndpoints()
    self.assertIn('not compatible', six.text_type(ex_ctx.exception))
 def testLocalEndpointCompatibleWithTestEndpoint(self):
   properties.VALUES.api_endpoint_overrides.testing.Set('https://localhost/')
   properties.VALUES.api_endpoint_overrides.toolresults.Set(TEST_RESULTS)
   endpoints.ValidateTestServiceEndpoints()
 def testTestEndpointsAreCompatible(self):
   properties.VALUES.api_endpoint_overrides.testing.Set(TEST_TESTING)
   properties.VALUES.api_endpoint_overrides.toolresults.Set(TEST_RESULTS)
   endpoints.ValidateTestServiceEndpoints()
 def testDefaultEndpoints(self):
   properties.VALUES.api_endpoint_overrides.testing.Set(None)
   properties.VALUES.api_endpoint_overrides.toolresults.Set(None)
   endpoints.ValidateTestServiceEndpoints()