Exemple #1
0
def test_xtheme_extra_views(rf):
    with override_current_theme_class(H2G2Theme):
        request = rf.get("/", {"name": "Arthur Dent"})
        # Simulate /xtheme/greeting
        response = extra_view_dispatch(request, "greeting")
        assert force_text(response.content) == "So long, and thanks for all the fish, Arthur Dent"
        # Try that again (to exercise the _VIEW_CACHE code path):
        response = extra_view_dispatch(request, "greeting")
        assert force_text(response.content) == "So long, and thanks for all the fish, Arthur Dent"
        # Now test that CBVs work
        assert not extra_view_dispatch(request, "faux").content
Exemple #2
0
def test_xtheme_extra_views(rf):
    with override_current_theme_class(H2G2Theme):
        request = rf.get("/", {"name": "Arthur Dent"})
        # Simulate /xtheme/greeting
        response = extra_view_dispatch(request, "greeting")
        assert force_text(
            response.content
        ) == "So long, and thanks for all the fish, Arthur Dent"
        # Try that again (to exercise the _VIEW_CACHE code path):
        response = extra_view_dispatch(request, "greeting")
        assert force_text(
            response.content
        ) == "So long, and thanks for all the fish, Arthur Dent"
        # Now test that CBVs work
        assert not extra_view_dispatch(request, "faux").content
Exemple #3
0
def test_xtheme_extra_view_exceptions(rf):
    with override_current_theme_class(H2G2Theme):
        request = rf.get("/")
        assert extra_view_dispatch(request, "vogons").status_code == 404
        with pytest.raises(ImproperlyConfigured):
            assert extra_view_dispatch(request, "true")
Exemple #4
0
def test_xtheme_extra_view_exceptions(rf):
    with override_current_theme_class(H2G2Theme):
        request = rf.get("/")
        assert extra_view_dispatch(request, "vogons").status_code == 404
        with pytest.raises(ImproperlyConfigured):
            assert extra_view_dispatch(request, "true")