cmd/jujud: upgrades test refactoring

A bunch of refactoring of the tests relating to machine agent upgrades.
Blank line before comment.