Exemplo n.º 1
0
from django.contrib.auth.models import AnonymousUser

import plata
from plata.contact.models import Contact
from plata.product.stock.models import StockTransaction
from plata.shop import notifications, signals
from plata.shop.models import TaxClass, Order, OrderItem

signals.contact_created.connect(
    notifications.ContactCreatedHandler(always_bcc=['*****@*****.**']),
    weak=False)
signals.order_paid.connect(
    notifications.SendInvoiceHandler(always_bcc=['*****@*****.**']),
    weak=False)
signals.order_paid.connect(notifications.SendPackingSlipHandler(
    always_to=['*****@*****.**'], always_bcc=['*****@*****.**']),
                           weak=False)


class Empty(object):
    pass


def get_request(**kwargs):
    """
    Helper method which creates a mock request object
    """

    request = Empty()
    request.session = {}
    request.user = AnonymousUser()
Exemplo n.º 2
0
try:  # pragma: no cover
    from django.contrib.auth import get_user_model

    User = get_user_model()
except ImportError:
    from django.contrib.auth.models import User

signals.contact_created.connect(
    notifications.ContactCreatedHandler(always_bcc=["*****@*****.**"]),
    weak=False)
signals.order_paid.connect(
    notifications.SendInvoiceHandler(always_bcc=["*****@*****.**"]),
    weak=False)
signals.order_paid.connect(
    notifications.SendPackingSlipHandler(always_to=["*****@*****.**"],
                                         always_bcc=["*****@*****.**"]),
    weak=False,
)


class Empty(object):
    pass


def get_request(**kwargs):
    """
    Helper method which creates a mock request object
    """

    request = Empty()
    request.session = {}