The idea of splitting integration from unittests is good in theory
but leads to a lot of mental overhead. Besides whenever a tests
interacts with a database it isn't a unittest anyway.
Replace assert statements with appropriate assert* method.
Replace 'assert' with 'assert*' method.
Convert tests.unit.forms.widget_tests to use TestCase class.
Convert bankcard tests to use TestCase.
Convert tests.unit.logging_tests to use TestCase.
This is the result of wild grepping through the codebase. Nothing too
exciting to report, really. create_product now sets a products structure
to 'child' if a parent is specified.
Oscar now supports setting a price of zero for products.
Please note that currently a price of zero has no other special-casing
apart in a template. Notably, setting a currency is still required and
you can't add products to a basket of a different currency. This can
be improved if needed.
In the templates, the product price is displayed as "Free" instead
of zero (and whatever currency).
Writing an (initially failing) test exposed slightly incorrect handling
of the passed price in the stockrecord factory, as a price of zero
would always be replaced by the default price.
Fixes #1347.
This completes the move away from partner wrappers to strategies. All
the methods for determining price and availability information have now
been removed from the partner classes.
The helper policy class ("DelegateToStockRecord") have been removed too
as they no longer have methods to call on the stockrecord.
Introduce new API method for strategies (for basket lines)
This allows availability to be correctly determined for complex basket
lines which use basket attributes to hold information vital for
availability decisions. An example is bundle products that store bundle
product IDs in the basket line attributes.
A new template tag is also introduced, which has an inconsistent name
with the product version. This will be fixed in a later commit.
Extend strategy class to work with variant products
The strategy API has gained a new method: fetch_for_group, which is for
fetching stock information about a group/parent/abstract product. Like
the existing fetch method, this is highly customisable.
For a group product, we fetch all relevant variants and stockrecords; we
then pass these to the methods that determine availability and pricing.
The pricing display logic for a group product has been simplified a bit.
We now just look at the first stockrecord and use that price - we no
longer say "From £X". This seems to be a more common pattern in the
wild and allows the templates to be simplfied as they no longer need to
handle group and standalone products separately.