Ok, I found out why the tests passed. The .rest_connection/rest_api_config.yaml file I tested with contained this which took a different code path.

:ssh_keys: 
- /root/.ssh/api_user_key
- /root/.ssh/monkey-cloud-1
- /root/.ssh/monkey-cloud-2
- /root/.ssh/monkey-cloud-3
- /root/.ssh/monkey-cloud-4
- /root/.ssh/monkey-cloud-5
- /root/.ssh/monkey-cloud-6
- /root/.ssh/monkey-cloud-7
- /root/.ssh/monkey-cloud-8