Esempio n. 1
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)
Esempio n. 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 == 'version':
         if dim_value not in self._version_ids:
             raise exceptions.VersionNotFoundError(dim_value)
     # TODO(b/78015882): add proper support for locales and orientations
     # 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)
     else:
         raise exceptions.InvalidIosDimensionNameError(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