Consolidate logic to use the lib in one location in the tests