#NEWLINE# def test_column_editable_list( ) : #NEWLINE# #INDENT# ( app , db , admin ) = setup ( ) #NEWLINE# ( Model1 , Model2 ) = create_models ( db ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_editable_list = [ 'test1' , 'enum_field' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# fill_db ( db , Model1 , Model2 ) #NEWLINE# client = app . test_client ( ) #NEWLINE# rv = client . get ( '/admin/model1/' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'data-role="x-editable"' in data ) ) #NEWLINE# rv = client . post ( '/admin/model1/ajax/update/' , data = { #NEWLINE# #INDENT# 'test1-1' : 'change-success-1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Record was successfully saved.' == data ) ) #NEWLINE# rv = client . get ( '/admin/model1/' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'change-success-1' in data ) ) #NEWLINE# rv = client . post ( '/admin/model1/ajax/update/' , data = { #NEWLINE# #INDENT# 'enum_field-1' : 'problematic-input' , #NEWLINE# #UNINDENT# } ) #NEWLINE# eq_ ( rv . status_code , 500 ) #NEWLINE# rv = client . post ( '/admin/model1/ajax/update/' , data = { #NEWLINE# #INDENT# 'test1-1000' : 'problematic-input' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# eq_ ( rv . status_code , 500 ) #NEWLINE# rv = client . post ( '/admin/model1/ajax/update/' , data = { #NEWLINE# #INDENT# 'test2-1' : 'problematic-input' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# eq_ ( rv . status_code , 500 ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_editable_list = [ 'model1' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# rv = client . post ( '/admin/model2/ajax/update/' , data = { #NEWLINE# #INDENT# 'model1-1' : '3' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Record was successfully saved.' == data ) ) #NEWLINE# rv = client . get ( '/admin/model2/' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_3' in data ) )