def test_etcAlternativesConf(self, os_path_realpath_mock, os_path_islink_mock, os_listdir_mock, os_path_exists_mock): hostInfo = HostInfoLinux() os_path_exists_mock.return_value = False result = hostInfo.etcAlternativesConf('',[]) self.assertEquals(result, []) os_path_exists_mock.return_value = True os_listdir_mock.return_value = ['config1'] os_path_islink_mock.return_value = True os_path_realpath_mock.return_value = 'real_path_to_conf' result = [] hostInfo.etcAlternativesConf('project', result) self.assertEquals(result[0]['name'], 'config1') self.assertEquals(result[0]['target'], 'real_path_to_conf')