Fix tests; make testing easier by splitting out setting of api vars `_prepare_request`