def test_hive_site_null_hs2krb():
 tmpdir = tempfile.mkdtemp()
 saved = None
 try:
  class Getter(object, ):
   def get(self):
    return tmpdir
  xml = hive_site_xml(is_local=True, use_sasl=False, hs2_kerberos_principal=None)
  file(os.path.join(tmpdir, 'hive-site.xml'), 'w').write(xml)
  beeswax.hive_site.reset()
  saved = beeswax.conf.HIVE_CONF_DIR
  beeswax.conf.HIVE_CONF_DIR = Getter()
  assert_equal(beeswax.hive_site.get_conf()['hive.metastore.warehouse.dir'], u'/abc')
  assert_equal(beeswax.hive_site.get_hiveserver2_kerberos_principal('localhost'), None)
  assert_equal(beeswax.hive_site.get_hiveserver2_authentication(), 'NOSASL')
 finally:
  beeswax.hive_site.reset()
  if (saved is not None):
   beeswax.conf.HIVE_CONF_DIR = saved
  shutil.rmtree(tmpdir)

def test_hive_site_null_hs2krb ( ) : tmpdir = tempfile . mkdtemp ( ) saved = None try : class Getter ( object , ) : def get ( self ) : return tmpdir xml = hive_site_xml ( is_local = True , use_sasl = False , hs2_kerberos_principal = None ) file ( os . path . join ( tmpdir , 'hive-site.xml' ) , 'w' ) . write ( xml ) beeswax . hive_site . reset ( ) saved = beeswax . conf . HIVE_CONF_DIR beeswax . conf . HIVE_CONF_DIR = Getter ( ) assert_equal ( beeswax . hive_site . get_conf ( ) [ 'hive.metastore.warehouse.dir' ] , u'/abc' ) assert_equal ( beeswax . hive_site . get_hiveserver2_kerberos_principal ( 'localhost' ) , None ) assert_equal ( beeswax . hive_site . get_hiveserver2_authentication ( ) , 'NOSASL' ) finally : beeswax . hive_site . reset ( ) if ( saved is not None ) : beeswax . conf . HIVE_CONF_DIR = saved shutil . rmtree ( tmpdir )
test hive-site parsing with null hs2 kerberos principal .