

def test_list_columns():
    (app, db, admin) = setup()
    (Model1, Model2) = create_models(db)
    view = CustomModelView(Model1, db.session, column_list=['test1', 'test3'], column_labels=dict(test1='Column1'))
    admin.add_view(view)
    eq_(len(admin._list_columns), 2)
    eq_(view._list_columns, [('test1', 'Column1'), ('test3', 'Test3')])
    client = app.test_client()
    rv = client.get('/admin/model1/')
    data = rv.data.decode('utf-8')
    ok_(('Column1' in data))
    ok_(('Test2' not in data))
    view2 = CustomModelView(Model1, db.session, endpoint='model1_2', column_list=[Model1.test1, Model1.test3], column_labels=dict(test1='Column1'))
    admin.add_view(view2)
    eq_(len(view2._list_columns), 2)
    eq_(view2._list_columns, [('test1', 'Column1'), ('test3', 'Test3')])
    rv = client.get('/admin/model1_2/')
    data = rv.data.decode('utf-8')
    ok_(('Column1' in data))
    ok_(('Test2' not in data))

dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_basic.py test_list_columns/VarMisuse@71/92 `view`->`admin`