From 1c9c3418fa25e0a058da0ab1d692ca2211b36e58 Mon Sep 17 00:00:00 2001 From: Owen Synge Date: Tue, 24 May 2016 11:20:01 +0200 Subject: [PATCH] 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 --- ceph_deploy/tests/test_gather_keys_with_mon.py | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.47.3