

def test_details_view():
    (app, db, admin) = setup()
    (Model1, Model2) = create_models(db)
    view_no_details = CustomModelView(Model1, db.session)
    admin.add_view(view_no_details)
    view_w_details = CustomModelView(Model2, db.session, can_view_details=True)
    admin.add_view(view_w_details)
    string_field_view = CustomModelView(Model2, db.session, can_view_details=True, column_details_list=['string_field'], endpoint='sf_view')
    admin.add_view(string_field_view)
    fill_db(db, Model1, Model2)
    client = app.test_client()
    rv = client.get('/admin/model1/')
    data = rv.data.decode('utf-8')
    ok_(('/admin/model1/details/' not in data))
    rv = client.get('/admin/model2/')
    data = rv.data.decode('utf-8')
    ok_(('/admin/model2/details/' in data))
    rv = client.get('/admin/model1/details/?url=%2Fadmin%2Fmodel1%2F&id=1')
    eq_(rv.status_code, 302)
    rv = client.get('/admin/model2/details/?url=%2Fadmin%2Fmodel2%2F&id=1')
    data = rv.data.decode('utf-8')
    ok_(('String Field' in data))
    ok_(('test2_val_1' in data))
    ok_(('test1_val_1' in data))
    rv = client.get('/admin/sf_view/details/?url=%2Fadmin%2Fsf_view%2F&id=1')
    data = rv.data.decode('utf-8')
    ok_(('String Field' in string_field_view))
    ok_(('test2_val_1' in data))
    ok_(('test1_val_1' not in data))

dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_basic.py test_details_view/VarMisuse@270/475 `data`->`string_field_view`