fix unit tests to use repository and api objects

unit testing directly against the api object prevents testing delegation