I have to change .clean()
which has deep logic behind the scene.
Since it is not directly related to my feature I decided to mock it out and cut the complicate logic. Then I can use mommy.make
to fulfill the testing objects.
Here is my code.
https://gist.github.com/elcolie/cfeadfbb29996823abfb998447cfe822
If I run them individually it works. But fail when run full suite.
I had follow these:
why would a django test fail only when the full test suite is run?
Django unit tests failing when run with other test cases
But does not work.
My errors: 2 last test cases fail
Failure
Traceback (most recent call last):
File "/Users/el/.pyenv/versions/3.6.0/lib/python3.6/unittest/mock.py", line 1179, in patched
return func(*args, **keywargs)
File "/Users/el/Code/eneos-pos-web/eneos/apps/mail_logs/mail_data_tests.py", line 194, in test_user_change_status_13July_query_all_false
self.assertDictEqual(expected_obj, summary)
AssertionError: {'tod[71 chars] 0, 'today_active_email_true': 0, 'today_active_email_none': 1} != {'tod[71 chars] 0, 'today_active_email_true': 0, 'today_active_email_none': 0}
{'today_active_email': 1,
'today_active_email_false': 0,
- 'today_active_email_none': 1,
? ^
+ 'today_active_email_none': 0,
? ^
'today_active_email_true': 0,
'today_all_orders': 1}
Failure
Traceback (most recent call last):
File "/Users/el/.pyenv/versions/3.6.0/lib/python3.6/unittest/mock.py", line 1179, in patched
return func(*args, **keywargs)
File "/Users/el/Code/eneos-pos-web/eneos/apps/mail_logs/mail_data_tests.py", line 231, in test_user_change_status_16July
self.assertDictEqual(expected_obj, summary)
AssertionError: {'today_active_email': 1, 'today_active_email_fals[84 chars]': 1} != {'today_all_orders': 1, 'today_active_email': 1, '[84 chars]': 0}
{'today_active_email': 1,
'today_active_email_false': 0,
- 'today_active_email_none': 1,
? ^
+ 'today_active_email_none': 0,
? ^
'today_active_email_true': 0,
'today_all_orders': 1}