def __init__(self, catalog=None): """Construct an IosCatalogManager object from a TestEnvironmentCatalog. Args: catalog: an iOS TestEnvironmentCatalog from Testing API. If it is not injected, the catalog is retrieved from the Testing service. Attributes: catalog: an iOS TestEnvironmentCatalog. """ self.catalog = catalog or util.GetIosCatalog() 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] # 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
def __init__(self, catalog=None): """Construct an IosCatalogManager object from a TestEnvironmentCatalog. Args: catalog: an iOS TestEnvironmentCatalog from Testing API. If it is not injected, the catalog is retrieved from the Testing service. Attributes: catalog: an iOS TestEnvironmentCatalog. """ self.catalog = catalog or util.GetIosCatalog() models = self.catalog.models versions = self.catalog.versions # TODO(b/78015882): decide if the iOS catalog will have a runtimeConfig. # locales = self.catalog.runtimeConfiguration.locales # orientations = self.catalog.runtimeConfiguration.orientations # self._locale_ids = [l.id for l in locales] # self._orientation_ids = [o.id for o in orientations] self._model_ids = [m.id for m in models] self._version_ids = [v.id for v in versions] # TODO(b/78015882): add proper support for locales and orientations self._locale_ids = ['en'] self._orientation_ids = ['portrait', 'landscape'] # 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
def Run(self, args): """Run the 'gcloud firebase test ios 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 iOS locales we want to have printed later. """ catalog = util.GetIosCatalog(self.context) return catalog.runtimeConfiguration.locales
def Run(self, args): """Run the 'gcloud firebase test ios 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 iOS model we want to show a description of. """ catalog = util.GetIosCatalog(self.context) for model in catalog.models: if model.id == args.model_id: return model raise exceptions.ModelNotFoundError(args.model_id)
def Run(self, args): """Run the 'gcloud firebase test ios 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.IosVersion object to describe. """ catalog = util.GetIosCatalog(self.context) for version in catalog.versions: if version.id == args.version_id: return version raise exceptions.VersionNotFoundError(args.version_id)
def Run(self, args): """Run the 'gcloud firebase test ios 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.GetIosCatalog(self.context) for locale in catalog.runtimeConfiguration.locales: if locale.id == args.locale: return locale raise exceptions.LocaleNotFoundError(args.locale)
def Run(self, args): """Run the 'gcloud firebase test ios 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.GetIosCatalog(self.context) filtered_models = [ model for model in catalog.models if model.supportedVersionIds ] self._epilog = util.GetDeprecatedTagWarning(filtered_models) return filtered_models