# Path: ceph_deploy/hosts/remotes.py
# def platform_information(_linux_distribution=None):
# def parse_os_release(release_path='/etc/os-release'):
# def machine_type():
# def write_sources_list(url, codename, filename='ceph.list', mode=0o644):
# def write_sources_list_content(content, filename='ceph.list', mode=0o644):
# def write_yum_repo(content, filename='ceph.repo'):
# def set_apt_priority(fqdn, path='/etc/apt/preferences.d/ceph.pref'):
# def set_repo_priority(sections, path='/etc/yum.repos.d/ceph.repo', priority='1'):
#     def remove_whitespace_from_assignments():
# def write_conf(cluster, conf, overwrite):
# def write_keyring(path, key, uid=-1, gid=-1):
# def create_mon_path(path, uid=-1, gid=-1):
# def create_done_path(done_path, uid=-1, gid=-1):
# def create_init_path(init_path, uid=-1, gid=-1):
# def append_to_file(file_path, contents):
# def path_getuid(path):
# def path_getgid(path):
# def readline(path):
# def path_exists(path):
# def get_realpath(path):
# def listdir(path):
# def makedir(path, ignored=None, uid=-1, gid=-1):
# def unlink(_file):
# def write_monitor_keyring(keyring, monitor_keyring, uid=-1, gid=-1):
# def write_file(path, content, mode=0o644, directory=None, uid=-1, gid=-1):
# def touch_file(path):
# def get_file(path):
# def object_grep(term, file_object):
# def grep(term, file_path):
# def shortname():
# def which_service():
# def which(executable):
# def make_mon_removed_dir(path, file_name):
# def safe_mkdir(path, uid=-1, gid=-1):
# def safe_makedirs(path, uid=-1, gid=-1):
# def zeroing(dev):
# def enable_yum_priority_obsoletes(path="/etc/yum/pluginconf.d/priorities.conf"):


    from cStringIO import StringIO
    from io import StringIO
from ceph_deploy.hosts import remotes
except ImportError:



class TestObjectGrep(object):

    def setup(self):
        self.file_object = StringIO('foo\n')
        self.file_object.seek(0)

    def test_finds_term(self):
        assert remotes.object_grep('foo', self.file_object)

    def test_does_not_find_anything(self):
        assert remotes.object_grep('bar', self.file_object) is False


class TestWhich(object):

    def test_executable_is_a_directory(self, monkeypatch):
        monkeypatch.setattr(remotes.os.path, 'exists', lambda x: True)
        monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: False)
        assert remotes.which('foo') is None

    def test_executable_does_not_exist(self, monkeypatch):
        monkeypatch.setattr(remotes.os.path, 'exists', lambda x: False)
        monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: True)
        assert remotes.which('foo') is None

    def test_executable_exists_as_file(self, monkeypatch):

# Path: ceph_deploy/hosts/remotes.py
# def platform_information(_linux_distribution=None):
# def parse_os_release(release_path='/etc/os-release'):
# def machine_type():
# def write_sources_list(url, codename, filename='ceph.list', mode=0o644):
# def write_sources_list_content(content, filename='ceph.list', mode=0o644):
# def write_yum_repo(content, filename='ceph.repo'):
# def set_apt_priority(fqdn, path='/etc/apt/preferences.d/ceph.pref'):
# def set_repo_priority(sections, path='/etc/yum.repos.d/ceph.repo', priority='1'):
#     def remove_whitespace_from_assignments():
# def write_conf(cluster, conf, overwrite):
# def write_keyring(path, key, uid=-1, gid=-1):
# def create_mon_path(path, uid=-1, gid=-1):
# def create_done_path(done_path, uid=-1, gid=-1):
# def create_init_path(init_path, uid=-1, gid=-1):
# def append_to_file(file_path, contents):
# def path_getuid(path):
# def path_getgid(path):
# def readline(path):
# def path_exists(path):
# def get_realpath(path):
# def listdir(path):
# def makedir(path, ignored=None, uid=-1, gid=-1):
# def unlink(_file):
# def write_monitor_keyring(keyring, monitor_keyring, uid=-1, gid=-1):
# def write_file(path, content, mode=0o644, directory=None, uid=-1, gid=-1):
# def touch_file(path):
# def get_file(path):
# def object_grep(term, file_object):
# def grep(term, file_path):
# def shortname():
# def which_service():
# def which(executable):
# def make_mon_removed_dir(path, file_name):
# def safe_mkdir(path, uid=-1, gid=-1):
# def safe_makedirs(path, uid=-1, gid=-1):
# def zeroing(dev):
# def enable_yum_priority_obsoletes(path="/etc/yum/pluginconf.d/priorities.conf"):


# Path: ceph_deploy/tests/unit/hosts/test_remotes.py
    from cStringIO import StringIO
    from io import StringIO
from ceph_deploy.hosts import remotes

except ImportError:



class TestObjectGrep(object):

    def setup(self):
        self.file_object = StringIO('foo\n')
        self.file_object.seek(0)

    def test_finds_term(self):
        assert remotes.object_grep('foo', self.file_object)

    def test_does_not_find_anything(self):
        assert remotes.object_grep('bar', self.file_object) is False


class TestWhich(object):

    def test_executable_is_a_directory(self, monkeypatch):
        monkeypatch.setattr(remotes.os.path, 'exists', lambda x: True)
        monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: False)
        assert remotes.which('foo') is None

    def test_executable_does_not_exist(self, monkeypatch):
        monkeypatch.setattr(remotes.os.path, 'exists', lambda x: False)
        monkeypatch.setattr(remotes.os.path, 'isfile', lambda x: True)
        assert remotes.which('foo') is None

    def test_executable_exists_as_file(self, monkeypatch):

        monkeypatch.setattr(remotes.os.path, 'exists', lambda x: True)