Skip to content

Commit

Permalink
Consolidate oscar.test.factories imports in the test modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mvantellingen committed May 18, 2015
1 parent 6fad63a commit 174d4dc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions tests/functional/checkout/customer_checkout_tests.py
Expand Up @@ -4,7 +4,6 @@

from oscar.core.loading import get_model, get_class
from oscar.test import factories
from oscar.test.factories import UserAddressFactory
from oscar.test.testcases import WebTestCase
from . import CheckoutMixin

Expand Down Expand Up @@ -34,7 +33,7 @@ class TestShippingAddressView(CheckoutMixin, WebTestCase):

def setUp(self):
super(TestShippingAddressView, self).setUp()
self.user_address = UserAddressFactory(
self.user_address = factories.UserAddressFactory(
user=self.user, country=self.create_shipping_country())

def test_requires_login(self):
Expand Down Expand Up @@ -65,7 +64,7 @@ def test_only_shipping_addresses_are_shown(self):
not_shipping_country = factories.CountryFactory(
iso_3166_1_a2='US', name="UNITED STATES",
is_shipping_country=False)
not_shipping_address = UserAddressFactory(
not_shipping_address = factories.UserAddressFactory(
user=self.user, country=not_shipping_country, line4='New York')
self.add_product_to_basket()
page = self.get(reverse('checkout:shipping-address'))
Expand All @@ -87,7 +86,8 @@ class TestUserAddressUpdateView(CheckoutMixin, WebTestCase):
def setUp(self):
country = self.create_shipping_country()
super(TestUserAddressUpdateView, self).setUp()
self.user_address = UserAddressFactory(user=self.user, country=country)
self.user_address = factories.UserAddressFactory(
user=self.user, country=country)

def test_requires_login(self):
response = self.get(
Expand Down Expand Up @@ -128,7 +128,7 @@ class TestDeleteUserAddressView(CheckoutMixin, WebTestCase):
def setUp(self):
super(TestDeleteUserAddressView, self).setUp()
self.country = self.create_shipping_country()
self.user_address = UserAddressFactory(
self.user_address = factories.UserAddressFactory(
user=self.user, country=self.country)

def test_requires_login(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/catalogue/reviews/form_tests.py
@@ -1,8 +1,7 @@
from django.test import TestCase

from oscar.apps.catalogue.reviews import forms
from oscar.test.factories import create_product
from oscar.test.factories import UserFactory
from oscar.test.factories import create_product, UserFactory


class TestReviewForm(TestCase):
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/offer/applicator_tests.py
Expand Up @@ -5,17 +5,18 @@

from oscar.apps.offer import models
from oscar.apps.offer.utils import Applicator
from oscar.test import factories
from oscar.test.basket import add_product
from oscar.test.factories import (
BenefitFactory, ConditionalOfferFactory, ConditionFactory, RangeFactory)
BasketFactory, RangeFactory, BenefitFactory, ConditionFactory,
ConditionalOfferFactory)

from oscar.test.basket import add_product


class TestOfferApplicator(TestCase):

def setUp(self):
self.applicator = Applicator()
self.basket = factories.create_basket(empty=True)
self.basket = BasketFactory()
rng = RangeFactory(includes_all_products=True)
self.condition = ConditionFactory(
range=rng, type=ConditionFactory._meta.model.VALUE,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/offer/availability_tests.py
@@ -1,8 +1,8 @@
from django.test import TestCase

from oscar.apps.offer import models
from oscar.test.factories import create_order
from oscar.test.factories import OrderDiscountFactory, UserFactory
from oscar.test.factories import (
create_order, OrderDiscountFactory, UserFactory)


class TestAPerUserConditionalOffer(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/order/model_tests.py
Expand Up @@ -13,8 +13,7 @@
OrderNote, OrderDiscount)
from oscar.test.basket import add_product
from oscar.test.factories import (
create_order, create_offer, create_voucher, create_basket)
from oscar.test.factories import (
create_order, create_offer, create_voucher, create_basket,
OrderFactory, OrderLineFactory, ShippingAddressFactory,
ShippingEventFactory)

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/payment/model_tests.py
Expand Up @@ -5,14 +5,13 @@

from oscar.apps.payment.models import Bankcard
from oscar.test import factories
from oscar.test.factories import SourceFactory


class TestAPaymentSource(TestCase):

def setUp(self):
order = factories.create_order()
self.source = SourceFactory(order=order)
self.source = factories.SourceFactory(order=order)

def test_allocation_doesnt_error(self):
self.source.allocate(D('100.00'))
Expand Down

0 comments on commit 174d4dc

Please sign in to comment.