Beispiel #1
0
 def CmdWildcardIterator(self, uri_or_str, result_type=ResultType.URIS):
   """
   Helper to instantiate gslib.WildcardIterator, passing
   self.bucket_storage_uri_class to support mocking/testing.
   Args are same as gslib.WildcardIterator interface, but filling in most
   of the values from Command instance state).
   """
   return wildcard_iterator.wildcard_iterator(
       uri_or_str, self.proj_id_handler, result_type=result_type,
       bucket_storage_uri_class=self.bucket_storage_uri_class,
       headers=self.headers, debug=self.debug)
Beispiel #2
0
  def WildcardIterator(self, uri_or_str):
    """
    Helper to instantiate gslib.WildcardIterator. Args are same as
    gslib.WildcardIterator interface, but this method fills in most of the
    values from class state.

    Args:
      uri_or_str: StorageUri or URI string naming wildcard objects to iterate.
    """
    return wildcard_iterator.wildcard_iterator(
        uri_or_str, self.proj_id_handler,
        bucket_storage_uri_class=self.bucket_storage_uri_class,
        headers=self.headers, debug=self.debug)
Beispiel #3
0
  def _WildcardIterator(self, uri_or_str):
    """
    Helper to instantiate gslib.WildcardIterator. Args are same as
    gslib.WildcardIterator interface, but this method fills in most of the
    values from instance state.

    Args:
      uri_or_str: StorageUri or URI string naming wildcard objects to iterate.
    """
    return wildcard_iterator.wildcard_iterator(
        uri_or_str, self.proj_id_handler,
        bucket_storage_uri_class=self.bucket_storage_uri_class,
        headers=self.headers, debug=self.debug)
Beispiel #4
0
 def CmdWildcardIterator(self, uri_or_str, result_type=ResultType.URIS):
     """
 Helper to instantiate gslib.WildcardIterator, passing
 self.bucket_storage_uri_class to support mocking/testing.
 Args are same as gslib.WildcardIterator interface, but filling in most
 of the values from Command instance state).
 """
     return wildcard_iterator.wildcard_iterator(
         uri_or_str,
         self.proj_id_handler,
         result_type=result_type,
         bucket_storage_uri_class=self.bucket_storage_uri_class,
         headers=self.headers,
         debug=self.debug)
Beispiel #5
0
def test_wildcard_iterator(uri_or_str, debug=0):
    """
  Convenience method for instantiating a testing instance of
  WildCardIterator, without having to specify all the params of that class
  (like bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri).
  Also naming the factory method this way makes it clearer in the test code
  that WildcardIterator needs to be set up for testing.

  Args are same as for wildcard_iterator.wildcard_iterator(), except there's
  no bucket_storage_uri_class arg.

  Returns:
    WildcardIterator.IterUris(), over which caller can iterate.
  """
    return wildcard_iterator.wildcard_iterator(
        uri_or_str, proj_id_handler, mock_storage_service.MockBucketStorageUri, debug=debug
    )
Beispiel #6
0
def test_wildcard_iterator(uri_or_str, debug=0):
  """
  Convenience method for instantiating a testing instance of
  WildCardIterator, without having to specify all the params of that class
  (like bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri).
  Also naming the factory method this way makes it clearer in the test code
  that WildcardIterator needs to be set up for testing.

  Args are same as for wildcard_iterator.wildcard_iterator(), except there's
  no bucket_storage_uri_class arg.

  Returns:
    WildcardIterator.IterUris(), over which caller can iterate.
  """
  return wildcard_iterator.wildcard_iterator(
      uri_or_str, proj_id_handler,
      mock_storage_service.MockBucketStorageUri, debug=debug)
Beispiel #7
0
def test_wildcard_iterator(uri_or_str,
                           result_type=wildcard_iterator.ResultType.URIS,
                           headers=None, debug=0):
  """
  Convenience method for instantiating a testing
  instance of WildCardIterator, without having to specify
  bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri.
  Also naming the factory method this way makes it clearer in the test
  code that WildcardIterator needs to be set up for testing.

  Args, Returns, and Raises are same as for
  wildcard_iterator.wildcard_iterator(), except there's no
  bucket_storage_uri_class arg.
  """
  return wildcard_iterator.wildcard_iterator(
      uri_or_str, result_type, headers, debug,
      mock_storage_service.MockBucketStorageUri)
Beispiel #8
0
def test_wildcard_iterator(uri_or_str,
                           result_type=wildcard_iterator.ResultType.URIS,
                           headers=None,
                           debug=0):
    """
  Convenience method for instantiating a testing
  instance of WildCardIterator, without having to specify
  bucket_storage_uri_class=mock_storage_service.MockBucketStorageUri.
  Also naming the factory method this way makes it clearer in the test
  code that WildcardIterator needs to be set up for testing.

  Args, Returns, and Raises are same as for
  wildcard_iterator.wildcard_iterator(), except there's no
  bucket_storage_uri_class arg.
  """
    return wildcard_iterator.wildcard_iterator(
        uri_or_str, result_type, headers, debug,
        mock_storage_service.MockBucketStorageUri)