summaryrefslogtreecommitdiff
path: root/tests/test_django.py
Commit message (Collapse)AuthorAge
* django: Clarify behavior around ``abstract=True``Raphaël Barrois2016-03-12
| | | | See issue #280.
* Fix mute_signals behavior for signals with cachingIlya Baryshev2015-07-05
| | | | | | | | | Connecting signals (with use_caching=True) inside mute_signals was breaking unmute on exit. Paused receivers were not running. This was caused by signal cache not being restored after unpatching. Workaround is to clear signal cache on exit. Fixes #212
* Properly handle custom Django managers (Closes #201).Raphaël Barrois2015-05-31
| | | | | | The actual behavior of Django with custom managers and inherited abstract models is rather complex, so this had to be adapted to the actual Django source code.
* Add lazy loading to factory.Iterator.Raphaël Barrois2015-05-24
| | | | | | | | | | | factory.Iterator no longers begins iteration of its argument on declaration, since this behavior may trigger database query when that argument is, for instance, a Django queryset. The ``factory.Iterator``'s argument will only be called when the containing ``Factory`` is first evaluated; this means that factories using ``factory.Iterator(models.MyThingy.objects.all())`` will no longer call the database at import time.
* Fix test startup for Django==1.6Raphaël Barrois2015-04-27
|
* Clarify .build() issue with Django>1.8 (Ref #198).Raphaël Barrois2015-04-25
| | | | | | | | | | | | | | | | | | | | | | | | From 1.8 onwards, this crashes: >>> a = MyModel() # Don't save >>> b = MyOtherModel(fkey_to_mymodel=a) In turn, it breaks: class MyModelFactory(factory.django.DjangoModelFactory): class Meta: model = MyModel class MyOtherModelFactory(factory.django.DjangoModelFactory): class Meta: model = MyOtherModel fkey_to_mymodel = factory.SubFactory(MyModelFactory) MyOtherModelFactory.build() # Breaks The error message is: Cannot assign "MyModel()": "MyModel" instance isn't saved in the database. See https://code.djangoproject.com/ticket/10811 for details.
* Remove warnings with Django 1.7 (Closes #195).Raphaël Barrois2015-04-14
| | | | | | | Builds upon pull request by @shinuza: - Properly import ``get_model`` - Run ``django.setup()`` before importing any models.
* Fix imports for Django 1.8Raphaël Barrois2015-04-02
|
* Support declarations in FileField/ImageField.Raphaël Barrois2015-03-27
| | | | Previously, the declarations (``factory.Sequence`` & co) weren't properly computed.
* Respect default manager in DjangoModelFactory (Closes #192).Raphaël Barrois2015-03-27
| | | | | The previous version tries to use ``cls._default_manager`` all the time, which breaks with ``manager.using(db_name)``.
* Update header years.Raphaël Barrois2015-03-26
|
* Turn FileField/ImageField into normal fields (Closes #141).Raphaël Barrois2015-03-26
| | | | | Previously, they ran as post_generation hooks, meaning that they couldn't be checked in a model's ``save()`` method, for instance.
* Add support for multidb with Django (Closes #171).Raphaël Barrois2015-03-26
| | | | | | | | | | | | | | The ``factory.django.DjangoModelFactory`` now takes an extra option: ``` class MyFactory(factory.django.DjangoModelFactory): class Meta: model = models.MyModel database = 'replica' ``` This will create all instances of ``models.Model`` in the ``'replica'`` database.
* Fix issues between mute_signals() and factory inheritance (Closes #183).Raphaël Barrois2015-03-26
| | | | | | Previously, if a factory was decorated with ``@mute_signals`` and one of its descendant called another one of its descendant, signals weren't unmuted properly.
* Remove automagic pk-based sequence setupRaphaël Barrois2014-11-16
| | | | | | | | | | | | | | | | | | | | | | | | Related to issues #78, #92, #103, #111, #153, #170 The default value of all sequences is now 0; the automagic ``_setup_next_sequence`` behavior of Django/SQLAlchemy has been removed. This feature's only goal was to allow the following scenario: 1. Run a Python script that uses MyFactory.create() a couple of times (with a unique field based on the sequence counter) 2. Run the same Python script a second time Without the magical ``_setup_next_sequence``, the Sequence counter would be set to 0 at the beginning of each script run, so both runs would generate objects with the same values for the unique field ; thus conflicting and crashing. The above behavior having only a very limited use and bringing various issues (hitting the database on ``build()``, problems with non-integer or composite primary key columns, ...), it has been removed. It could still be emulated through custom ``_setup_next_sequence`` methods, or by calling ``MyFactory.reset_sequence()``.
* Fix support for Django 1.7.Raphaël Barrois2014-09-03
|
* Fix test running without django (Closes #161).Raphaël Barrois2014-09-03
|
* tests: Update to Django new 'duplicate file' mechanism.Raphaël Barrois2014-08-21
|
* Provide readable errors when Meta.model isn't set (Closes #137).Raphaël Barrois2014-06-21
|
* Rename 'target' to 'model'.Raphaël Barrois2014-05-18
|
* Switch tests to class Meta.Raphaël Barrois2014-05-18
|
* factory.django: Fix counter inheritance with abstract models.Raphaël Barrois2014-05-18
|
* Fix 'gif' image tests.Raphaël Barrois2014-04-20
| | | | The latest pillow has changed the default gif palette, so we'll use a normalized RGB palette instead.
* Improve mute_signals (Closes #122).Raphaël Barrois2014-01-21
|
* Added "prevent_signals" decorator/context managerIlya Pirogov2014-01-21
|
* django: Fix lazy loading of 'son' factories (Closes #109).Raphaël Barrois2013-11-25
|
* django: Add tests for 'pk=None' with get_or_create.Raphaël Barrois2013-10-29
| | | | See issue #61.
* Fix Django sequences with abstract base models.Raphaël Barrois2013-09-25
|
* Allow FACTORY_FOR = 'app.Model' for Django (Closes #66).Raphaël Barrois2013-08-28
|
* More fixes to testsv2.1.2Raphaël Barrois2013-08-14
|
* Fix default color for factory.django.ImageFieldRaphaël Barrois2013-07-02
|
* tests: Safer againt not-installed Django.Raphaël Barrois2013-06-27
|
* Add factory.django.ImageField (Closes #52).Raphaël Barrois2013-06-27
|
* Fix FileField (bytes instead of str)Raphaël Barrois2013-06-15
|
* Add factory.django.FileField (See #52)Raphaël Barrois2013-06-15
|
* Fix coverageRaphaël Barrois2013-06-15
|
* Add django-based tests for DjangoModelFactory.Raphaël Barrois2013-06-10