Mock of unit test for non class method testing. Uses globals so might
just convert to a test class.