I have figured out how to use with-redefs for mocking out functions during testing
refined it