Exemple #1
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)
Exemple #2
0
 def ValidateDimensionAndValue(self, dim_name, dim_value):
     """Validates that a matrix dimension has a valid name and value."""
     if dim_name == _MODEL_DIMENSION:
         if dim_value not in self._model_ids:
             raise exceptions.ModelNotFoundError(dim_value)
     elif dim_name == _VERSION_DIMENSION:
         if dim_value not in self._version_ids:
             raise exceptions.VersionNotFoundError(dim_value)
     elif dim_name == _LOCALE_DIMENSION:
         if dim_value not in self._locale_ids:
             raise exceptions.LocaleNotFoundError(dim_value)
     elif dim_name == _ORIENTATION_DIMENSION:
         if dim_value not in self._orientation_ids:
             raise exceptions.OrientationNotFoundError(dim_value)
     else:
         raise exceptions.InvalidDimensionNameError(dim_name)
     return dim_value
 def ValidateDimensionAndValue(self, dim_name, dim_value):
     """Validates that a matrix dimension has a valid name and value."""
     if dim_name == 'model':
         if dim_value not in self._model_ids:
             raise exceptions.ModelNotFoundError(dim_value)
     elif dim_name == 'locale':
         if dim_value not in self._locale_ids:
             raise exceptions.LocaleNotFoundError(dim_value)
     elif dim_name == 'orientation':
         if dim_value not in self._orientation_ids:
             raise exceptions.OrientationNotFoundError(dim_value)
     elif dim_name == 'version':
         if dim_value not in self._version_ids:
             # Users are allowed to specify either version name or version ID.
             version_id = self._version_name_to_id.get(dim_value, None)
             if not version_id:
                 raise exceptions.VersionNotFoundError(dim_value)
             return version_id
     else:
         raise exceptions.InvalidDimensionNameError(dim_name)
     return dim_value