I'm trying out Django Dynamic Fixture (DDF). It has a few of its own Exceptions, one being BadDataError, generated when "the data passed to a field has some problem (not unique or invalid) or a required attribute is in ignore list".
For example, this
# Entry.text is models.CharField(max_length=1024, null=False, blank=False)
G(Entry, text=None)
will generate a BadDataError
, as Django will raise an IntegrityError
(text cannot be None).
I guess DDF captures the IntegrityError
and wraps it in its BadDataError
exception as the error I get is
django_dynamic_fixture.ddf.BadDataError: ('core.models.Entry', IntegrityError('NOT NULL constraint failed: core_entry.text',))
The issue is that I would like to test for an IntegrityError
. How would I be able to do so while still using DDF?