  def testGetCredentialsFromMalformedProfileFile(self, mock_azure_credentials):
    """Test that an error is raised when the profile file is incomplete."""
    # If the profile name exists but there are missing entries, should raise
    # a ValueError
    mock_azure_credentials.return_value = None

    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.JSON_FILE)

    with self.assertRaises(errors.CredentialsConfigurationError) as error:
      _, _ = common.GetCredentials(profile_name='incomplete_profile_name')
      mock_azure_credentials.assert_not_called()
    self.assertEqual(
        'Profile name incomplete_profile_name not found in credentials file '
        '{0:s}'.format(
            os.environ['AZURE_CREDENTIALS_PATH']), str(error.exception))
Test that an error is raised when the profile file is incomplete.
tests/providers/azure/internal/test_common.py