Saturday, January 12, 2019

Can a class which inherits from factory.DjangoModelFactory use Django TestCase asserts?

Hi,

I have a problem with tests. We defined a class called DefaultUserFactory which inherits from factory.DjangoModelFactory, and I want to use asserts in this class such as assertEqual. What is the best approach to do it? I tried to inherit both from factory.DjangoModelFactory and from Django class TestCase but it doesn't work. I thought about passing a parameter from the calling function and then call assertEqual of the calling function's self. But it seems too complicated. Is there a better approach?

You can see our code on GitHub:



Thanks,
אורי (Uri)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABD5YeHN6tMzx4UKO%3D-xP5pskepveuT1S8OcCyaTL1JX6sT1iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment