  def testGetCredentialsFromInvalidProfileFile(self, mock_azure_credentials):
    """Test that an error is raised when a profile file contain invalid JSON."""
    # If a profile name is passed to the method, then it will look for a
    # credential file (default path being ~/.azure/credentials.json). We can
    # set a particular path by setting the AZURE_CREDENTIALS_PATH variable.
    mock_azure_credentials.return_value = None

    # If the file is not a valid json file, should raise a ValueError
    os.environ['AZURE_CREDENTIALS_PATH'] = os.path.join(
        os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(
            os.path.realpath(__file__))))), azure_mocks.STARTUP_SCRIPT)
    with self.assertRaises(errors.InvalidFileFormatError) as error:
      _, _ = common.GetCredentials(profile_name='foo')
      mock_azure_credentials.assert_not_called()
    self.assertEqual(
        'Could not decode JSON file. Please verify the file format: Expecting '
        'value: line 1 column 1 (char 0)', str(error.exception))
Test that an error is raised when a profile file contain invalid JSON.
tests/providers/azure/internal/test_common.py