

def test_url_args():
    (app, db, admin) = setup()
    (Model1, Model2) = create_models(db)
    view = CustomModelView(Model1, db.session, page_size=2, column_searchable_list=['test1'], column_filters=['test1'])
    admin.add_view(view)
    db.session.add(Model1('data1'))
    db.session.add(Model1('data2'))
    db.session.add(Model1('data3'))
    db.session.add(Model1('data4'))
    db.session.commit()
    client = app.test_client()
    rv = client.get('/admin/model1/')
    data = rv.data.decode('utf-8')
    ok_(('data1' in data))
    ok_(('data3' not in data))
    rv = client.get('/admin/model1/?page=1')
    data = rv.data.decode('utf-8')
    ok_(('data1' not in data))
    ok_(('data3' in data))
    rv = client.get('/admin/model1/?sort=0&desc=1')
    data = rv.data.decode('utf-8')
    ok_(('data1' not in data))
    ok_(('data3' in data))
    ok_(('data4' in data))
    rv = client.get('/admin/model1/?search=data1')
    data = rv.data.decode('utf-8')
    ok_(('data1' in data))
    ok_(('data2' not in data))
    rv = client.get('/admin/model1/?search=^data1')
    data = rv.data.decode('utf-8')
    ok_(('data2' not in data))
    rv = client.get('/admin/model1/?flt0=0&flt0v=data1')
    data = rv.data.decode('utf-8')
    ok_(('data1' in data))
    rv = client.get('/admin/model1/?flt0=1&flt0v=data1')
    data = rv.data.decode('utf-8')
    ok_(('data2' in data))

dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_basic.py test_url_args/original