Ejemplo n.º 1
0
    def __init__(self, catalog=None):
        """Construct an AndroidCatalogManager object from a TestEnvironmentCatalog.

    Args:
      catalog: an Android TestEnvironmentCatalog from Testing API. If it is not
        injected, the catalog is retrieved from the Testing service.

    Attributes:
      catalog: an Android TestEnvironmentCatalog.
    """
        self.catalog = catalog or util.GetAndroidCatalog()
        models = self.catalog.models
        versions = self.catalog.versions
        locales = self.catalog.runtimeConfiguration.locales
        orientations = self.catalog.runtimeConfiguration.orientations

        self._model_ids = [m.id for m in models]
        self._version_ids = [v.id for v in versions]
        self._locale_ids = [l.id for l in locales]
        self._orientation_ids = [o.id for o in orientations]

        self._version_name_to_id = {v.versionString: v.id for v in versions}

        # Dimension defaults are lazily computed and cached by GetDefault* methods.
        self._default_model = None
        self._default_version = None
        self._default_locale = None
        self._default_orientation = None
Ejemplo n.º 2
0
    def Run(self, args):
        """Run the 'gcloud firebase test android locales list' command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation (i.e. group and command arguments combined).

    Returns:
      The list of Android locales we want to have printed later.
    """
        catalog = util.GetAndroidCatalog(self.context)
        return catalog.runtimeConfiguration.locales
Ejemplo n.º 3
0
    def Run(self, args):
        """Run the 'gcloud firebase test android models list' command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation (i.e. group and command arguments combined).

    Returns:
      The list of device models we want to have printed later. Obsolete models
      with no currently supported OS versions are filtered out.
    """
        catalog = util.GetAndroidCatalog(self.context)
        return [model for model in catalog.models if model.supportedVersionIds]
Ejemplo n.º 4
0
    def Run(self, args):
        """Run the 'gcloud firebase test android locales describe' command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation (i.e. group and command arguments combined).

    Returns:
      The testing_v1_messages.Locale object to describe.
    """
        catalog = util.GetAndroidCatalog(self.context)
        for locale in catalog.runtimeConfiguration.locales:
            if locale.id == args.locale:
                return locale
        raise exceptions.LocaleNotFoundError(args.locale)
Ejemplo n.º 5
0
  def Run(self, args):
    """Run the 'gcloud firebase test android models describe' command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation (i.e. group and command arguments combined).

    Returns:
      The Android model we want to show a description of.
    """
    catalog = util.GetAndroidCatalog(self.context)
    for model in catalog.models:
      if model.id == args.model_id:
        return model
    raise exceptions.ModelNotFoundError(args.model_id)
Ejemplo n.º 6
0
    def Run(self, args):
        """Run the 'gcloud firebase test android versions describe' command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation (i.e. group and command arguments combined).

    Returns:
      The testing_v1_messages.AndroidVersion object to describe.
    """
        catalog = util.GetAndroidCatalog(self.context)
        for version in catalog.versions:
            if version.id == args.version_id:
                return version
        raise exceptions.VersionNotFoundError(args.version_id)