From: Owen Synge Date: Tue, 24 May 2016 09:20:01 +0000 (+0200) Subject: ceph_deploy.tests.test_gather_keys_with_mon: Mock shortname X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c9c3418fa25e0a058da0ab1d692ca2211b36e58;p=ceph-deploy.git ceph_deploy.tests.test_gather_keys_with_mon: Mock shortname Since gatherkeys now uses distro.conn.remote_module.shortname() We need to mock this also. Signed-off-by: Owen Synge --- diff --git a/ceph_deploy/tests/test_gather_keys_with_mon.py b/ceph_deploy/tests/test_gather_keys_with_mon.py index 7ac6426..08141f9 100644 --- a/ceph_deploy/tests/test_gather_keys_with_mon.py +++ b/ceph_deploy/tests/test_gather_keys_with_mon.py @@ -51,6 +51,9 @@ class mock_remote_module(object): def get_file(self, path): return self.get_file_result + def shortname(self): + hostname_split = self.longhostname.split('.') + return hostname_split[0] class mock_conn(object): def __init__(self): @@ -66,12 +69,14 @@ def mock_hosts_get_file_key_content(host, **kwargs): output = mock_distro() mon_keyring = '[mon.]\nkey = %s\ncaps mon = allow *\n' % new.generate_auth_key() output.conn.remote_module.get_file_result = mon_keyring + output.conn.remote_module.longhostname = host return output def mock_hosts_get_file_key_content_none(host, **kwargs): output = mock_distro() output.conn.remote_module.get_file_result = None + output.conn.remote_module.longhostname = host return output