nitely / Spirit

Spirit is a modern Python based forum built on top of Django framework
http://spirit.readthedocs.io
MIT License
1.16k stars 332 forks source link

Some tests misusing assertTrue for comparisons #305

Closed code-review-doctor closed 2 years ago

code-review-doctor commented 2 years ago

assertTrue is not for comparing arguments, should use assertEqual for that.

The developer's intent of the test was to compare argument 1 with argument 2, which is not happening. Really what is happening is the test is passing because first argument is truthy. The correct method to use is assertEqual. more details

https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L204 https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L206 https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L209 https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L211 https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L218 https://github.com/nitely/Spirit/blob/13f338cf20415102de2e3ef0a125551281d1bc3c/spirit/category/admin/tests.py#L220

I found this issue automatically, see other issues here