testlibrary: Tweak some helper functions
testlibrary: Tweak some helper functions

This will make the next commit simpler, and in my opinion this makes the
code more readable.

(cherry picked from commit 8f85f77ff9c1b1dea02ab96771a764ff86e7c024)

flatpak/flatpak,flatpak/flatpak,flatpak/flatpak,flatpak/flatpak,flatpak/flatpak