def test_qs_keyed_session(self): pg = PeopleGrid() pg.apply_qs_args() flask.request.args['op(firstname)'] = '!eq' pg2 = PeopleGrid() pg2.apply_qs_args() eq_(pg2.column('firstname').filter.op, '!eq') flask.request.args = MultiDict([('session_key', pg.session_key)]) pg = PeopleGrid() pg.apply_qs_args() eq_(pg.column('firstname').filter.op, 'eq')
def test_qs_keyed_session_without_override(self): pg = PeopleGrid() pg.apply_qs_args() flask.request.args = MultiDict([ ('session_key', pg.session_key), ('op(createdts)', '!eq'), ('v1(createdts)', '2017-05-06'), ]) pg2 = PeopleGrid() pg2.apply_qs_args() assert not pg2.column('firstname').filter.op assert not pg2.column('firstname').filter.value1 eq_(pg2.column('createdts').filter.op, '!eq') eq_(pg2.column('createdts').filter.value1, datetime(2017, 5, 6))
def test_qs_default_session(self): pg = PeopleGrid() pg.apply_qs_args() flask.request.args = MultiDict() pg2 = PeopleGrid() pg2.apply_qs_args() eq_(pg2.column('firstname').filter.op, 'eq') assert '_PeopleGrid' in flask.session['dgsessions'] assert pg.session_key in flask.session['dgsessions'] assert pg2.session_key in flask.session['dgsessions']
def test_qs_apply_prevents_session_load(self): pg = PeopleGrid() pg.apply_qs_args() flask.request.args = MultiDict([ ('session_key', pg.session_key), ('apply', None), ]) pg2 = PeopleGrid() pg2.apply_qs_args() assert not pg2.column('firstname').filter.op assert not pg2.column('firstname').filter.value1
def test_qs_no_session(self): pg = PeopleGrid() pg.apply_qs_args() assert pg.column('firstname').filter.op is None