The tests were failing on python 2 due to the fact that the __init__.py
wasn't written so it wasn't a valid module. With this commit we now
also fully leverage pytest functionality to handle temporary paths for
us.
Add setting to allow SlugField and AutoSlugField accept unicode and automatically generate unicode-containing slugs.
Since there is no way to override SlugField and AutoSlugField in existing Oscar models, it was decided to pass `allow_unicode` parameter if this setting enable. This allows to achieve backwards compatibility with Django versions under 1.9, when this parameter was not supported yet. If parameter specified in the field expliticly - we do not override it, which allow to control slug fields individually in a normal way. For the reasons, explained above, standard SlugField was replaced with a custom one with the single slight change - control over `allow_unicode` parameter by the mentioned setting.
The tests check if the year 2010 is a valid option but since only the
last 5 years are rendered this is no longer the case. For now I've
changed the tests to check if 2014 is valid which should be the case the
next few years. A better option is to use the `freezegun` module in the
future.
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.
Fix validate_payment_event for payment events with no lines specified
Currently, handle_payment_event defaults lines and line_quantities to None,
however, calling it with these defaults will result in an exception being
raised in validate_payment_event because it expects iterables.
This commit also adds tests to cover validate_payment_event.
Fixes stockrecord availability validation message in the case when stock is lower than allocation. Previously the message that appeared contained negative numbers. For example: "a maximum of -1 can be bought". Now it will display: "no stock available"
The offer tests contained a stray test case that I suppose was once
intended as a base class for all the other tests. But it's only used
twice, and for very little gain, so let's delete it.
Fix ValueError in tests when assigning unsaved instance
Django now throws a ValueError when an unsaved instance is assigned:
https://docs.djangoproject.com/en/1.8/releases/1.8/#assigning-unsaved-objects-to-relations-raises-an-error
This commit changes the offending lines to create objects in the
database instead. But I don't understand why I don't need to make
the same changes for e.g. the country factory.
But I don't really care, as long as the tests pass. I'm guessing it has
something to do with factory-boy and the get_or_create statement.
Unfortunately, this will make our test suite slower. But to make up for
it, Django 1.8 introduces the setUpTestCase method, which we can use
once Django 1.7 is removed.
The changes should be obvious and non-controversial. Under Django 1.7+,
the AppConfig is used to register signal receivers instead of just
registering then when models are registered.
This removes all the bits and bobs where we referenced South, or added
some code supporting it. Documentation will be updated in a later
commit, together with other Django changes.
Working on sets causes a random order of returned fields while using
existing_user_fields as reported in django-oscar/django-oscar#1597.
Changed to work only on lists, which remain correct
order.
Closes #1605.
Closes #1597.
The config was picking the wrong directory so the custom test templates
were not used during tests.
Notes
- Fix missing i18n load tags
- Remove mixed tab/space indentation
- Add two settings tests
Simplify and increase test coverage for PhoneNumberField
PR #1645 pointed to an issue with phone numbers. After digging into the
code for a while, I opted to redo the phone number field implementation
according to the Django documentation. It always takes me a bit of time
to grok descriptors; the new implementation avoids them.
Note that this does not fix any issue; it's just a simplication done
while searching for the bug.