images: remove redundancy in some of the test code.