#NEWLINE# def test_alter_table( self ) : #NEWLINE# #INDENT# resp = _make_query ( self . client , "CREATE TABLE test_alter_table (a int) COMMENT 'Before Alter';" , database = self . db_name ) #NEWLINE# resp = wait_for_query_to_finish ( self . client , resp , max = 30.0 ) #NEWLINE# resp = self . client . get ( ( '/metastore/table/%s/test_alter_table' % self . db_name ) ) #NEWLINE# assert_true ( 'test_alter_table' , resp . content ) #NEWLINE# assert_true ( 'Before Alter' , resp . content ) #NEWLINE# resp = self . client . post ( reverse ( 'metastore:alter_table' , kwargs = { #NEWLINE# #INDENT# 'database' : self . db_name , #NEWLINE# 'table' : 'test_alter_table' , #NEWLINE# #UNINDENT# } ) , { #NEWLINE# #INDENT# 'new_table_name' : 'table_altered' , #NEWLINE# #UNINDENT# } ) #NEWLINE# json_resp = json . loads ( resp . content ) #NEWLINE# assert_equal ( 'table_altered' , json_resp [ 'data' ] [ 'name' ] , json_resp ) #NEWLINE# resp = self . client . post ( reverse ( 'metastore:alter_table' , kwargs = { #NEWLINE# #INDENT# 'database' : self . db_name , #NEWLINE# 'table' : 'table_altered' , #NEWLINE# #UNINDENT# } ) , { #NEWLINE# #INDENT# 'comment' : 'After Alter' , #NEWLINE# #UNINDENT# } ) #NEWLINE# json_resp = json . loads ( resp . content ) #NEWLINE# assert_equal ( 'After Alter' , json_resp [ 'data' ] [ 'comment' ] , json_resp ) #NEWLINE# resp = self . client . post ( reverse ( 'metastore:alter_table' , kwargs = { #NEWLINE# #INDENT# 'database' : self . db_name , #NEWLINE# 'table' : 'table_altered' , #NEWLINE# #UNINDENT# } ) , { #NEWLINE# #INDENT# 'new_table_name' : 'bad name' , #NEWLINE# #UNINDENT# } ) #NEWLINE# json_resp = json . loads ( resp . content ) #NEWLINE# assert_equal ( 1 , json_resp [ 'status' ] , json_resp ) #NEWLINE# assert_true ( ( 'Failed to alter table' in json_resp [ 'data' ] ) , json_resp )