# Path: gslib/exception.py
# NO_URLS_MATCHED_PREFIX = 'No URLs matched'
# NO_URLS_MATCHED_GENERIC = (NO_URLS_MATCHED_PREFIX +
#                            '. Do the files you\'re operating on exist?')
# NO_URLS_MATCHED_TARGET = NO_URLS_MATCHED_PREFIX + ': %s'
# class AbortException(StandardError):
# class CommandException(StandardError):
# class ControlCException(Exception):
# class GcloudStorageTranslationError(Exception):
# class HashMismatchException(Exception):
# class IamChOnResourceWithConditionsException(Exception):
# class InvalidUrlError(Exception):
# class ExternalBinaryError(Exception):
#   def __init__(self, reason):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, reason, informational=False):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForGS(reason):
#   if not RUN_S3_TESTS:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForJSON(reason):
#   if USING_JSON_API:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForXML(reason):
#   """Skips the test if running S3 tests, or if prefer_api isn't set to json."""
#   if not USING_JSON_API or RUN_S3_TESTS:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func


import re
import gslib.tests.testcase as testcase
from gslib import exception
from gslib.tests.testcase.integration_testcase import SkipForGS
from gslib.tests.testcase.integration_testcase import SkipForJSON
from gslib.tests.testcase.integration_testcase import SkipForXML
from gslib.tests.util import ObjectToURI as suri
from gslib.tests.util import SetBotoConfigForTest
                                                  suri(bucket_uri2)))
    self.assertRegex(stdout, output_regex)

  @SkipForJSON('Testing XML only behavior.')
  def test_xml_fails(self):
    # Use HMAC for force XML API.
    boto_config_hmac_auth_only = [
        # Overwrite other credential types.
        ('Credentials', 'gs_oauth2_refresh_token', None),
        ('Credentials', 'gs_service_client_id', None),
        ('Credentials', 'gs_service_key_file', None),
        ('Credentials', 'gs_service_key_file_password', None),
        # Add HMAC credentials.
        ('Credentials', 'gs_access_key_id', 'dummykey'),
        ('Credentials', 'gs_secret_access_key', 'dummysecret'),
    ]
    with SetBotoConfigForTest(boto_config_hmac_auth_only):
      bucket_uri = 'gs://any-bucket-name'
      stderr = self.RunGsUtil(self._set_autoclass_cmd + ['on', bucket_uri],
                              return_stderr=True,
                              expected_status=1)
      self.assertIn('command can only be with the Cloud Storage JSON API',
                    stderr)

      stderr = self.RunGsUtil(self._get_autoclass_cmd + [bucket_uri],
                              return_stderr=True,
                              expected_status=1)
      self.assertIn('command can only be with the Cloud Storage JSON API',
                    stderr)


# Path: gslib/exception.py
# NO_URLS_MATCHED_PREFIX = 'No URLs matched'
# NO_URLS_MATCHED_GENERIC = (NO_URLS_MATCHED_PREFIX +
#                            '. Do the files you\'re operating on exist?')
# NO_URLS_MATCHED_TARGET = NO_URLS_MATCHED_PREFIX + ': %s'
# class AbortException(StandardError):
# class CommandException(StandardError):
# class ControlCException(Exception):
# class GcloudStorageTranslationError(Exception):
# class HashMismatchException(Exception):
# class IamChOnResourceWithConditionsException(Exception):
# class InvalidUrlError(Exception):
# class ExternalBinaryError(Exception):
#   def __init__(self, reason):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, reason, informational=False):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
#   def __str__(self):
#   def __init__(self, message):
#   def __repr__(self):
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForGS(reason):
#   if not RUN_S3_TESTS:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForJSON(reason):
#   if USING_JSON_API:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func
# 
# Path: gslib/tests/testcase/integration_testcase.py
# def SkipForXML(reason):
#   """Skips the test if running S3 tests, or if prefer_api isn't set to json."""
#   if not USING_JSON_API or RUN_S3_TESTS:
#     return unittest.skip(reason)
#   else:
#     return lambda func: func


# Path: gslib/tests/test_autoclass.py
import re
import gslib.tests.testcase as testcase
from gslib import exception
from gslib.tests.testcase.integration_testcase import SkipForGS
from gslib.tests.testcase.integration_testcase import SkipForJSON
from gslib.tests.testcase.integration_testcase import SkipForXML
from gslib.tests.util import ObjectToURI as suri
from gslib.tests.util import SetBotoConfigForTest

                                                  suri(bucket_uri2)))
    self.assertRegex(stdout, output_regex)

  @SkipForJSON('Testing XML only behavior.')
  def test_xml_fails(self):
    # Use HMAC for force XML API.
    boto_config_hmac_auth_only = [
        # Overwrite other credential types.
        ('Credentials', 'gs_oauth2_refresh_token', None),
        ('Credentials', 'gs_service_client_id', None),
        ('Credentials', 'gs_service_key_file', None),
        ('Credentials', 'gs_service_key_file_password', None),
        # Add HMAC credentials.
        ('Credentials', 'gs_access_key_id', 'dummykey'),
        ('Credentials', 'gs_secret_access_key', 'dummysecret'),
    ]
    with SetBotoConfigForTest(boto_config_hmac_auth_only):
      bucket_uri = 'gs://any-bucket-name'
      stderr = self.RunGsUtil(self._set_autoclass_cmd + ['on', bucket_uri],
                              return_stderr=True,
                              expected_status=1)
      self.assertIn('command can only be with the Cloud Storage JSON API',
                    stderr)

      stderr = self.RunGsUtil(self._get_autoclass_cmd + [bucket_uri],
                              return_stderr=True,
                              expected_status=1)
      self.assertIn('command can only be with the Cloud Storage JSON API',
                    stderr)


  @SkipForGS('Testing S3 only behavior')