<s> from django . test import TestCase <EOL> from oscar . apps . partner import strategy <EOL> from oscar . test import factories <EOL> class TestUseFirstStockRecordMixin ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . product = factories . create_product ( ) <EOL> self . mixin = strategy . UseFirstStockRecord ( ) <EOL> def test_selects_first_stockrecord_for_product ( self ) : <EOL> stockrecord = factories . create_stockrecord ( self . product ) <EOL> selected = self . mixin . select_stockrecord ( self . product ) <EOL> self . assertEqual ( selected . id , stockrecord . id ) <EOL> def test_returns_none_when_no_stock_records ( self ) : <EOL> self . assertIsNone ( self . mixin . select_stockrecord ( self . product ) ) </s>
