Ejemplo n.º 1
0
def initialize_editor_view(view_name, placeholder_name, request=None):
    if request is None:
        request = RequestFactory().get("/")
    request.user = SuperUser()
    if hasattr(request.GET, "_mutable"):
        request.GET._mutable = True  # Ahem
    request.GET.update({
        "theme": FauxTheme.identifier,
        "view": view_name,
        "ph": placeholder_name
    })

    with plugin_override():
        with override_provides("xtheme",
                               ["shoop_tests.xtheme.utils:FauxTheme"]):
            with override_current_theme_class(FauxTheme):
                yield EditorView(request=request, args=(), kwargs={})
Ejemplo n.º 2
0
def test_unknown_theme_fails(rf):
    request = rf.get("/", {"theme": printable_gibberish()})
    request.user = SuperUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Ejemplo n.º 3
0
def test_anon_cant_edit(rf):
    request = rf.get("/")
    request.user = AnonymousUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Ejemplo n.º 4
0
def test_unknown_theme_fails(rf):
    request = rf.get("/", {"theme": printable_gibberish()})
    request.user = SuperUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Ejemplo n.º 5
0
def test_anon_cant_edit(rf):
    request = rf.get("/")
    request.user = AnonymousUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf.urls import url
from shoop.xtheme.views.command import command_dispatch
from shoop.xtheme.views.editor import EditorView
from shoop.xtheme.views.extra import extra_view_dispatch

urlpatterns = [
    url(r"^xtheme/editor/$", EditorView.as_view(), name="xtheme_editor"),
    url(r"^xtheme/(?P<view>.+)/*$", extra_view_dispatch, name="xtheme_extra_view"),
    url(r"^xtheme/$", command_dispatch, name="xtheme"),
]
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf.urls import url
from shoop.xtheme.views.command import command_dispatch
from shoop.xtheme.views.editor import EditorView
from shoop.xtheme.views.extra import extra_view_dispatch

urlpatterns = [
    url(r"^xtheme/editor/$", EditorView.as_view(), name="xtheme_editor"),
    url(r"^xtheme/(?P<view>.+)/*$",
        extra_view_dispatch,
        name="xtheme_extra_view"),
    url(r"^xtheme/$", command_dispatch, name="xtheme"),
]