Unit tests mock connection updated to be more flexible