示例#1
0
def test_bool_arg_default(app, parser):
    arg = utils.make_bool_arg(default=True)
    request = app.test_request_context('/').request
    assert parser.parse_arg('test_bool', arg, request) is True
示例#2
0
def test_bool_arg_invalid(app, parser):
    arg = utils.make_bool_arg()
    request = app.test_request_context('/?test_bool=nope').request
    with pytest.raises(ValidationError):
        parser.parse_arg('test_bool', arg, request)
示例#3
0
def test_bool_arg_false(app, parser):
    arg = utils.make_bool_arg()
    request = app.test_request_context('/?test_bool=false').request
    assert parser.parse_arg('test_bool', arg, request) is False
示例#4
0
def test_bool_arg_default(app, parser):
    arg = utils.make_bool_arg(default=True)
    request = app.test_request_context('/').request
    assert parser.parse_arg('test_bool', arg, request) is True
示例#5
0
def test_bool_arg_invalid(app, parser):
    arg = utils.make_bool_arg()
    request = app.test_request_context('/?test_bool=nope').request
    with pytest.raises(ValidationError):
        parser.parse_arg('test_bool', arg, request)
示例#6
0
def test_bool_arg_false(app, parser):
    arg = utils.make_bool_arg()
    request = app.test_request_context('/?test_bool=false').request
    assert parser.parse_arg('test_bool', arg, request) is False