Unittest fixes.

Mostly this was making things work with factories instead of fixtures,
but I did fix a couple issues.