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

Refs #23620.
Or just make them a second commit here and we can squash before merging.