Fix cli command to use correct username and password

Make cli commands use the username and password provided to `with_user` method. Also add tests for the `with_user` and `_get_username_password` methods. The latter was added to help lookup for the correct username and password when executing a cli command.