# Path: oscar_mws/test/factories.py
# class UserFactory(factory.DjangoModelFactory):
# class CountryFactory(factory.DjangoModelFactory):
# class ProductClassFactory(factory.DjangoModelFactory):
# class BasketFactory(factory.DjangoModelFactory):
# class AmazonProfileFactory(factory.DjangoModelFactory):
# class ProductFactory(factory.DjangoModelFactory):
# class MerchantAccountFactory(factory.DjangoModelFactory):
# class AmazonMarketplaceFactory(factory.DjangoModelFactory):
# class FeedSubmissionFactory(factory.DjangoModelFactory):
# class PartnerFactory(factory.DjangoModelFactory):
# class StockRecordFactory(factory.DjangoModelFactory):
# class ShippingAddressFactory(factory.DjangoModelFactory):
# class OrderLineFactory(factory.DjangoModelFactory):
# class OrderFactory(factory.DjangoModelFactory):
# class FulfillmentOrderFactory(factory.DjangoModelFactory):
#     FACTORY_FOR = get_model('auth', 'User')
#     FACTORY_FOR = get_model('address', 'Country')
#     FACTORY_FOR = get_model('catalogue', 'ProductClass')
#     FACTORY_FOR = get_model('basket', 'Basket')
#     FACTORY_FOR = get_model('oscar_mws', 'AmazonProfile')
#     FACTORY_DJANGO_GET_OR_CREATE = ('product',)
#     FACTORY_FOR = get_model('catalogue', 'Product')
#     FACTORY_FOR = get_model('oscar_mws', 'MerchantAccount')
#     FACTORY_FOR = get_model('oscar_mws', 'AmazonMarketplace')
#     FACTORY_FOR = get_model('oscar_mws', 'FeedSubmission')
#     FACTORY_DJANGO_GET_OR_CREATE = ('submission_id',)
#     FACTORY_FOR = get_model('partner', 'Partner')
#     FACTORY_FOR = get_model('partner', 'StockRecord')
#     FACTORY_FOR = get_model('order', 'ShippingAddress')
#     FACTORY_FOR = get_model('order', 'Line')
#     FACTORY_FOR = get_model('order', 'Order')
#     FACTORY_FOR = get_model('oscar_mws', 'FulfillmentOrder')
#     def stockrecord(self, created, extracted, **kwargs):
# 
# Path: oscar_mws/models.py
# class FeedSubmission(am.AbstractFeedSubmission):
# class FeedReport(am.AbstractFeedReport):
# class FeedResult(am.AbstractFeedResult):
# class AmazonProfile(am.AbstractAmazonProfile):
# class FulfillmentOrder(am.AbstractFulfillmentOrder):
# class FulfillmentOrderLine(am.AbstractFulfillmentOrderLine):
# class FulfillmentShipment(am.AbstractFulfillmentShipment):
# class ShipmentPackage(am.AbstractShipmentPackage):
# class MerchantAccount(am.AbstractMerchantAccount):
# class AmazonMarketplace(am.AbstractAmazonMarketplace):


from lxml import etree
from decimal import Decimal as D
from collections import OrderedDict
from django.test import TestCase
from django.test.utils import override_settings
from oscar.apps.order.models import Line
from oscar.apps.catalogue.models import Product
from oscar_mws.test import factories
from oscar_mws import models as mwsm
            PRODUCT_TYPE_XML.format('ASIN', asin)
        )

    def test_enforcing_stockrecord_partner_sku(self):
        profile = factories.AmazonProfileFactory()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)

        profile.sku = 'fake12345'
        profile.save()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)

    @override_settings(MWS_ENFORCE_PARTNER_SKU=False)
    def test_enforcing_stockrecord_sku_is_skipped_when_disabled(self):
        profile = factories.AmazonProfileFactory()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertNotEquals(profile.sku, stockrecord.partner_sku)

    def test_deleting_profile_does_not_delete_associated_product(self):
        profile = factories.AmazonProfileFactory()
        self.assertEquals(Product.objects.count(), 1)
        profile.delete()
        self.assertEquals(Product.objects.count(), 1)


class TestFulfillmentOrderLineStatus(TestCase):

    def test_returns_order_status_when_not_shipped(self):
        status = mwsm.FulfillmentOrder.SUBMITTED

# Path: oscar_mws/test/factories.py
# class UserFactory(factory.DjangoModelFactory):
# class CountryFactory(factory.DjangoModelFactory):
# class ProductClassFactory(factory.DjangoModelFactory):
# class BasketFactory(factory.DjangoModelFactory):
# class AmazonProfileFactory(factory.DjangoModelFactory):
# class ProductFactory(factory.DjangoModelFactory):
# class MerchantAccountFactory(factory.DjangoModelFactory):
# class AmazonMarketplaceFactory(factory.DjangoModelFactory):
# class FeedSubmissionFactory(factory.DjangoModelFactory):
# class PartnerFactory(factory.DjangoModelFactory):
# class StockRecordFactory(factory.DjangoModelFactory):
# class ShippingAddressFactory(factory.DjangoModelFactory):
# class OrderLineFactory(factory.DjangoModelFactory):
# class OrderFactory(factory.DjangoModelFactory):
# class FulfillmentOrderFactory(factory.DjangoModelFactory):
#     FACTORY_FOR = get_model('auth', 'User')
#     FACTORY_FOR = get_model('address', 'Country')
#     FACTORY_FOR = get_model('catalogue', 'ProductClass')
#     FACTORY_FOR = get_model('basket', 'Basket')
#     FACTORY_FOR = get_model('oscar_mws', 'AmazonProfile')
#     FACTORY_DJANGO_GET_OR_CREATE = ('product',)
#     FACTORY_FOR = get_model('catalogue', 'Product')
#     FACTORY_FOR = get_model('oscar_mws', 'MerchantAccount')
#     FACTORY_FOR = get_model('oscar_mws', 'AmazonMarketplace')
#     FACTORY_FOR = get_model('oscar_mws', 'FeedSubmission')
#     FACTORY_DJANGO_GET_OR_CREATE = ('submission_id',)
#     FACTORY_FOR = get_model('partner', 'Partner')
#     FACTORY_FOR = get_model('partner', 'StockRecord')
#     FACTORY_FOR = get_model('order', 'ShippingAddress')
#     FACTORY_FOR = get_model('order', 'Line')
#     FACTORY_FOR = get_model('order', 'Order')
#     FACTORY_FOR = get_model('oscar_mws', 'FulfillmentOrder')
#     def stockrecord(self, created, extracted, **kwargs):
# 
# Path: oscar_mws/models.py
# class FeedSubmission(am.AbstractFeedSubmission):
# class FeedReport(am.AbstractFeedReport):
# class FeedResult(am.AbstractFeedResult):
# class AmazonProfile(am.AbstractAmazonProfile):
# class FulfillmentOrder(am.AbstractFulfillmentOrder):
# class FulfillmentOrderLine(am.AbstractFulfillmentOrderLine):
# class FulfillmentShipment(am.AbstractFulfillmentShipment):
# class ShipmentPackage(am.AbstractShipmentPackage):
# class MerchantAccount(am.AbstractMerchantAccount):
# class AmazonMarketplace(am.AbstractAmazonMarketplace):


# Path: tests/unit/test_models.py
from lxml import etree
from decimal import Decimal as D
from collections import OrderedDict
from django.test import TestCase
from django.test.utils import override_settings
from oscar.apps.order.models import Line
from oscar.apps.catalogue.models import Product
from oscar_mws.test import factories
from oscar_mws import models as mwsm

            PRODUCT_TYPE_XML.format('ASIN', asin)
        )

    def test_enforcing_stockrecord_partner_sku(self):
        profile = factories.AmazonProfileFactory()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)

        profile.sku = 'fake12345'
        profile.save()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)

    @override_settings(MWS_ENFORCE_PARTNER_SKU=False)
    def test_enforcing_stockrecord_sku_is_skipped_when_disabled(self):
        profile = factories.AmazonProfileFactory()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertNotEquals(profile.sku, stockrecord.partner_sku)

    def test_deleting_profile_does_not_delete_associated_product(self):
        profile = factories.AmazonProfileFactory()
        self.assertEquals(Product.objects.count(), 1)
        profile.delete()
        self.assertEquals(Product.objects.count(), 1)


class TestFulfillmentOrderLineStatus(TestCase):

    def test_returns_order_status_when_not_shipped(self):
        status = mwsm.FulfillmentOrder.SUBMITTED

        line = mwsm.FulfillmentOrderLine()