]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
ceph_deploy.tests.test_gather_keys_with_mon: Mock shortname wip-test-PR393-master
authorOwen Synge <osynge@suse.com>
Tue, 24 May 2016 09:20:01 +0000 (11:20 +0200)
committerOwen Synge <osynge@suse.com>
Tue, 24 May 2016 09:20:01 +0000 (11:20 +0200)
Since gatherkeys now uses distro.conn.remote_module.shortname()
We need to mock this also.

Signed-off-by: Owen Synge <osynge@suse.com>
ceph_deploy/tests/test_gather_keys_with_mon.py

index 7ac64266836c76f663464feab1a80b5f0aa65b0a..08141f9a707339cac5c4bc0537123e0ec33e62d9 100644 (file)
@@ -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