Fix test monkeypatching

We can't store method references directly on the class because they end
up bound to the class.