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.
Adds new functional tests for ShippingAddressView, PaymentDetailsView
and ThankYouView.
It's the second part of #1645.
Notes
* Adds a custom template to be able to test some functionalities of
PaymentDetailsView
* Adds an helper to the CheckoutMixin
Deprecate accessing categories without primary key
That approach is around from sometime around Oscar 0.6. With the
category refactor, it has become expensive to support. I doubt it has
any SEO impact, as e.g. Amazon has product IDs etc. all over their URLs.
@mbertheau seconded this opinion.
When we stopped storing the concatenated slugs on each category,
generating the URL for an individual category got more expensive. But
luckily it is safe to naively cache it, as the matching view only
considers the primary key any way. So even a stale cache should lead to
the right category.
As category slugs are relevant for SEO, it is often desirable to be able
to change them independently of the name.
Previously, Oscar by default updated the slug on each save().
This commit completely removes the logic to update an existing slug, as
it is an anti-pattern, as it breaks old links to the site.
It also doesn't raise a ValidationError in the save() method any more,
which is an anti pattern as well. Unfortunately, we can't validate
uniqueness in a clean_slug method (where it should live) as we need
treebeard's information about siblings, which is only available after
save.
This commit replaces the previous slug handling by a simpler approach:
if no slug is supplied, we generate one -- otherwise we assume the user
knows what they're doing.
* Uses factory-boy factories
* Adds helpers to the CheckoutMixin helper
* Adds plenty of functional tests
* Adds HTML IDs to some forms to be able to easily reference them
from our tests
@maikhoepfel:
This commit is the squashed version of #1645, but it
does not contain the template changes. The unused
ShippingAddressView code was already cherry-picked across in 549decb.
I also fixed some PEP8 issues.
06c2441 changed the way actions are submitted for on the dashboard's
order list view. This commit updates the test to match the new
behaviour.
I'd also argue that the two test methods test different aspects of the
same thing, so I merged them, which saves us one (relatively slow) test
run.
Parent/child products aren't supported in permission-based dashboard
Currently, a product's stockrecords are used to decide if a user is
allowed to edit a product or not. That doesn't work for parent products,
because they don't have stockrecords. So it's not possible to decide
whether a user is allowed to edit a parent product (and e.g. create
children) for it.
As far as I'm aware, this is not a regression of the
permission-dashboard; I don't think it ever worked. It just hasn't been
spotted because nobody needed it.
This commit also adds some tests to ensure this is enforced.
The ProductCreateUpdateView had untested logic to handle invalid parent
products. Unfortunately, it didn't work; the check returned a redirect,
which later was tried to access like a product.
The only place to issue a redirect for invalid products is the dispatch
method, so an altered check has been moved there.
This time with tests...
It was broken without anyone noticing, as reported in #1451. My work in
PR #1441 magically fixed it, but we should still test it.
Fixes #1451.
Also sneakily fixes the wrong URL in the release notes for the previous
commit.
We only needed it because Django 1.4 shipped with a pretty old version
of six. Support for that has been removed, and Django 1.5 ships with six
1.6.1, which is more current than we required.
This nicely avoids an issue with django-extra-views pinning a six
version which caused the sandbox build to fail:
https://travis-ci.org/tangentlabs/django-oscar/jobs/32223978#L971
Correct amount calculation when creating payment events in dashboard
The final line price was calculated as qty * qty * unit price, as the
line price was multiplied with the quantity for a second time. That's no
good.
Reported in #1442. Fixes #1442.
Ignore capitalisation of local part of email address
Most email servers don't respect capitalisation, and many users don't
know about it. So Oscar now does what the rest of the world does, and
ignores the capitalisation when looking up an email address.
Fixes #1179.