| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
This relies on the ``fake-factory`` library, and provides realistic
random values for most field types.
|
|
|
|
| |
The wording of the readme suggested that "attributes" is a strategy just like "build" and "create", but this is not the case in the implementation (for example keyword arguments do not work, SubFactory fields don't behave as expected), so I have removed the mention of this and replaced the attributes example to mention the "stub" strategy.
|
|
|
|
| |
Thanks to @nikolas for spotting it!
|
|
|
|
|
|
| |
Define ``Meta.rename = {'attrs': 'attributes'}``
if your model expects a ``attributes`` kwarg but you can't
define it since it's already reserved by the ``Factory`` class.
|
| |
|
| |
|
|
|
|
| |
Avoid hitting bugs with max shebang line length in jenkins.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
You may now use: ``make DJANGO_VERSION=1.7 test``.
Valid options:
* ``DJANGO_VERSION``
* ``MONGOENGINE_VERSION``
* ``ALCHEMY_VERSION``
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
Thanks to @nikolas for spotting it!
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Thanks to @DasAllFolks for spotting it!
|
|
|
|
|
|
|
| |
Builds upon pull request by @shinuza:
- Properly import ``get_model``
- Run ``django.setup()`` before importing any models.
|
| |
|
|
|
|
| |
So that it doesn't fail on ci...
|
|
|
|
|
|
|
| |
mongoengine>=0.9.0 and pymongo>=2.1 require extra parameters:
- The server connection timeout was set too high
- We have to define a ``read_preference``.
|
| |
|
| |
|
| |
|
|
|
|
| |
Previously, the declarations (``factory.Sequence`` & co) weren't properly computed.
|
|
|
|
|
| |
The previous version tries to use ``cls._default_manager`` all the time,
which breaks with ``manager.using(db_name)``.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Previously, they ran as post_generation hooks, meaning that they
couldn't be checked in a model's ``save()`` method, for instance.
|
|
|
|
|
| |
``StubFactory.build()`` is now supported, and maps to
``StubFactory.stub()``.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
This allows the following idiom:
``user = factory.fuzzy.FuzzyChoice(User.objects.all())``
Previously, the ``User.objects.all()`` queryset would have been
evaluated *at import time*; it is now evaluated with the first use of the
``FuzzyChoice``.
|
|
|
|
| |
Thanks to @shinuza for spotting this!
|
|
|
|
| |
As pointed by @glinmac.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
That file should be readable by PyPI's RST parser, which doesn't support
Sphinx constructs.
|
|
|
|
|
|
|
|
|
| |
Users may now call ``factory.fuzzy.get_random_state()`` to retrieve
the current random generator's state (isolated from the one used in
Python's ``random``).
That state can then be reinjected with
``factory.fuzzy.set_random_state(state)``.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Use ``obj`` for ``@post_generation``-decorated methods, instead of
``self``: this makes it clearer that the ``obj`` is an instance of the
model, and not of the ``Factory``.
Thanks to @jamescooke & @NiklasMM for spotting the typo.
|
| |
|