Used more specific asserts than assertTrue in the Django test suite.

Refs #23620.