Esempio n. 1
0
def test_unknown_theme_fails(rf):
    request = rf.get("/", {"theme": printable_gibberish()})
    request.user = SuperUser()
    request.shop = get_default_shop()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Esempio n. 2
0
def test_anon_cant_edit(rf):
    request = rf.get("/")
    request.user = AnonymousUser()
    request.shop = get_default_shop()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Esempio n. 3
0
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf.urls import url

from shuup.xtheme.views.command import command_dispatch
from shuup.xtheme.views.editor import EditorView
from shuup.xtheme.views.extra import extra_view_dispatch
from shuup.xtheme.views.plugins import (
    get_category_products_highlight,
    get_product_cross_sell_highlight,
    get_product_highlight,
    get_prouduct_selections_highlight,
)

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"),
    url(
        r"^xtheme-prod-hl/(?P<plugin_type>.*)/(?P<cutoff_days>\d+)/(?P<count>\d+)/(?P<cache_timeout>\d+)/$",
        get_product_highlight,
        name="xtheme-product-highlight",
    ),
    url(
        r"""
            ^xtheme-prod-cross-sell-hl/
            (?P<product_id>.*)/(?P<relation_type>.*)/(?P<use_parents>\d+)/
            (?P<count>\d+)/(?P<cache_timeout>\d+)/$
        """.strip(),
Esempio n. 4
0
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce 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 shuup.xtheme.views.command import command_dispatch
from shuup.xtheme.views.editor import EditorView
from shuup.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"),
]
Esempio n. 5
0
def test_unknown_theme_fails(rf):
    request = rf.get("/", {"theme": printable_gibberish()})
    request.user = SuperUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)
Esempio n. 6
0
def test_anon_cant_edit(rf):
    request = rf.get("/")
    request.user = AnonymousUser()
    with pytest.raises(Problem):
        EditorView.as_view()(request)