Distinguish active address fields definition and address hash generation in order to avoid hashing breaking when active address fields property is customized.
Most real-world instances will use postgresql instead of sqlite so it's
better to use postgres for the tests. This also allows us to easily add
tests for concurrency issues which is not supported by sqlite
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.
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.
Factory Boy for test fixtures & port address model tests
As previously discussed here
https://groups.google.com/d/topic/django-oscar/Owmi3J1rwlk/discussion
I have started working on the introduction of Factoryboy library into
django-oscar, to make the generation of data for unit tests easier. At
the moment I have only refactored test/unit/address/models_tests.py, but
the plan is to refactor all the existing tests. All the tests, of
course, pass.
Squashed commit of the work done in #1192
Fixes #1192