Add factory boy

This pull-request adds support for using the factory_boy package for easily create test fixtures.
I also has added this new fixtures to some of the existing tests (the API tests) while some things in those tests have been refactored as well.
The rest of the tests will have to be changed to use them too (see #761).