Refactor test jigs for reuse.

Also, back out the class-level knob for testing;  prefer instead a
controlled monkey-patch of the module.