예제 #1
0
def make_test_order(country, state):
    c = Contact(first_name="Gift", last_name="Tester", 
        role="Customer", email="*****@*****.**")
    c.save()
    if not isinstance(country, Country):
        country = Country.objects.get(iso2_code__iexact = country)
    ad = AddressBook(contact=c, description="home",
        street1 = "test", state=state, city="Portland",
        country = country, is_default_shipping=True,
        is_default_billing=True)
    ad.save()
    site = Site.objects.get_current()
    o = Order(contact=c, shipping_cost=Decimal('0.00'), site=site)
    o.save()

    p = Product.objects.get(slug='GIFT10')
    price = p.unit_price
    log.debug("creating with price: %s", price)
    item1 = OrderItem(order=o, product=p, quantity=2,
        unit_price=price, line_item_price=price*2)
    item1.save()

    detail = OrderItemDetail(name = 'email', value='*****@*****.**', sort_order=0, item=item1)
    detail.save()
    detail = OrderItemDetail(name = 'message', value='hello there', sort_order=0, item=item1)
    detail.save()

    return o
예제 #2
0
    def setUp(self):
        self.US = Country.objects.get(iso2_code__iexact = 'US')
        self.site = Site.objects.get_current()
        tax = config_get('TAX','MODULE')
        tax.update('satchmo.tax.modules.no')
        c = Contact(first_name="Jim", last_name="Tester", 
            role="Customer", email="*****@*****.**")
        c.save()
        ad = AddressBook(contact=c, description="home",
            street1 = "test", state="OR", city="Portland",
            country = self.US, is_default_shipping=True,
            is_default_billing=True)
        ad.save()
        o = Order(contact=c, shipping_cost=Decimal('6.00'), site=self.site)
        o.save()
        small = Order(contact=c, shipping_cost=Decimal('6.00'), site=self.site)
        small.save()

        p = Product.objects.get(slug='neat-book-soft')
        price = p.unit_price
        item1 = OrderItem(order=o, product=p, quantity=1,
            unit_price=price, line_item_price=price)
        item1.save()
        
        item1s = OrderItem(order=small, product=p, quantity=1,
            unit_price=price, line_item_price=price)
        item1s.save()
        
        p = Product.objects.get(slug='neat-book-hard')
        price = p.unit_price
        item2 = OrderItem(order=o, product=p, quantity=1,
            unit_price=price, line_item_price=price)
        item2.save()
        self.order = o
        self.small = small
예제 #3
0
    def setUp(self):
        self.US = Country.objects.get(iso2_code__iexact='US')
        self.site = Site.objects.get_current()
        tax = config_get('TAX', 'MODULE')
        tax.update('satchmo.tax.modules.no')
        c = Contact(first_name="Jim",
                    last_name="Tester",
                    role="Customer",
                    email="*****@*****.**")
        c.save()
        ad = AddressBook(contact=c,
                         description="home",
                         street1="test",
                         state="OR",
                         city="Portland",
                         country=self.US,
                         is_default_shipping=True,
                         is_default_billing=True)
        ad.save()
        o = Order(contact=c, shipping_cost=Decimal('6.00'), site=self.site)
        o.save()
        small = Order(contact=c, shipping_cost=Decimal('6.00'), site=self.site)
        small.save()

        p = Product.objects.get(slug='neat-book-soft')
        price = p.unit_price
        item1 = OrderItem(order=o,
                          product=p,
                          quantity=1,
                          unit_price=price,
                          line_item_price=price)
        item1.save()

        item1s = OrderItem(order=small,
                           product=p,
                           quantity=1,
                           unit_price=price,
                           line_item_price=price)
        item1s.save()

        p = Product.objects.get(slug='neat-book-hard')
        price = p.unit_price
        item2 = OrderItem(order=o,
                          product=p,
                          quantity=1,
                          unit_price=price,
                          line_item_price=price)
        item2.save()
        self.order = o
        self.small = small
예제 #4
0
def make_test_order(country, state, include_non_taxed=False):
    warnings.warn(
        "make_test_order is deprecated - Use TestOrderFactory instead",
        DeprecationWarning,
    )
    c = Contact(first_name="Tax",
                last_name="Tester",
                role="Customer",
                email="*****@*****.**")
    c.save()
    if not isinstance(country, Country):
        country = Country.objects.get(iso2_code__iexact=country)

    ad = AddressBook(
        contact=c,
        description="home",
        street1="test",
        state=state,
        city="Portland",
        country=country,
        is_default_shipping=True,
        is_default_billing=True,
    )
    ad.save()
    o = Order(contact=c, shipping_cost=Decimal("10.00"))
    o.save()

    p = Product.objects.get(slug="dj-rocks-s-b")
    price = p.unit_price
    item1 = OrderItem(order=o,
                      product=p,
                      quantity=5,
                      unit_price=price,
                      line_item_price=price * 5)
    item1.save()

    if include_non_taxed:
        p = Product.objects.get(slug="neat-book-hard")
        price = p.unit_price
        item2 = OrderItem(order=o,
                          product=p,
                          quantity=1,
                          unit_price=price,
                          line_item_price=price)
        item2.save()

    return o
예제 #5
0
def make_test_order(country, state, include_non_taxed=False, site=None):
    warnings.warn(
        "make_test_order is deprecated - Use TestOrderFactory instead",
        DeprecationWarning,
    )
    if not site:
        site = Site.objects.get_current()
    c = Contact(
        first_name="Tax", last_name="Tester", role="Customer", email="*****@*****.**"
    )
    c.save()
    if not isinstance(country, Country):
        country = Country.objects.get(iso2_code__iexact=country)

    ad = AddressBook(
        contact=c,
        description="home",
        street1="test",
        state=state,
        city="Portland",
        country=country,
        is_default_shipping=True,
        is_default_billing=True,
    )
    ad.save()
    o = Order(contact=c, shipping_cost=Decimal("10.00"), site=site)
    o.save()

    p = Product.objects.get(slug="dj-rocks-s-b")
    price = p.unit_price
    item1 = OrderItem(
        order=o, product=p, quantity=5, unit_price=price, line_item_price=price * 5
    )
    item1.save()

    if include_non_taxed:
        p = Product.objects.get(slug="neat-book-hard")
        price = p.unit_price
        item2 = OrderItem(
            order=o, product=p, quantity=1, unit_price=price, line_item_price=price
        )
        item2.save()

    return o
예제 #6
0
파일: tests.py 프로젝트: ToeKnee/jelly-roll
def make_test_order(country, state):
    c = Contact(first_name="Gift",
                last_name="Tester",
                role="Customer",
                email="*****@*****.**")
    c.save()
    if not isinstance(country, Country):
        country = Country.objects.get(iso2_code__iexact=country)
    ad = AddressBook(
        contact=c,
        description="home",
        street1="test",
        state=state,
        city="Portland",
        country=country,
        is_default_shipping=True,
        is_default_billing=True,
    )
    ad.save()
    o = Order(contact=c, shipping_cost=Decimal("0.00"))
    o.save()

    p = Product.objects.get(slug="GIFT10")
    price = p.unit_price
    log.debug("creating with price: %s", price)
    item1 = OrderItem(order=o,
                      product=p,
                      quantity=2,
                      unit_price=price,
                      line_item_price=price * 2)
    item1.save()

    detail = OrderItemDetail(name="email",
                             value="*****@*****.**",
                             sort_order=0,
                             item=item1)
    detail.save()
    detail = OrderItemDetail(name="message",
                             value="hello there",
                             sort_order=0,
                             item=item1)
    detail.save()

    return o