Exemplo n.º 1
0
def test_cache_header_roca(template, response, request):
    response.headers = bottle.HeaderDict()
    handler = mock_handler()
    faux_tpl = mock.Mock()
    roca_handler = mod.roca_view('foo', 'bar', template_func=faux_tpl)(handler)
    roca_handler()
    assert response.headers['Cache-Control'] == 'no-store'
Exemplo n.º 2
0
def test_roca_custom_template_func(template, request):
    handler = mock_handler()
    faux_tpl = mock.Mock()
    roca_handler = mod.roca_view('foo', 'bar', template_func=faux_tpl)(handler)
    roca_handler()
    assert faux_tpl.called
    assert not template.called
Exemplo n.º 3
0
def test_roca_with_defaults_merged(template, request):
    handler =  mock_handler(bar='baz')
    roca_handler = mod.roca_view('foo', 'bar', foo='bar')(handler)
    request.is_xhr = False
    roca_handler()
    template.assert_called_once_with('foo', foo='bar', bar='baz')
Exemplo n.º 4
0
def test_roca_as_view_deco_xhr(template, request):
    handler = mock_handler()
    roca_handler = mod.roca_view('foo', 'bar')(handler)
    request.is_xhr = True
    roca_handler()
    template.assert_called_once_with('bar')