# Path: multiscanner/common/utils.py
#     SSH = True
#     SSH = False
# def load_module(name, path):
# def list2cmdline(list):
# def convert_encoding(data, encoding='UTF-8', errors='replace'):
# def parse_config(config_object):
# def get_config_path(config_file, component):
# def dirname(path):
# def basename(path):
# def parseDir(directory, recursive=False, exclude=['__init__']):
# def parseFileList(FileList, recursive=False):
# def chunk_file_list(filelist, cmdlength=7191):
# def queue2list(queue):
# def hashfile(fname, hasher, blocksize=65536):
# def sshconnect(hostname, port=22, username=None, password=None, pkey=None,
#                key_filename=None, timeout=None, allow_agent=True,
#                look_for_keys=True, compress=False, sock=None):
# def sessionexec(client, cmd):
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):


import os
import types
import mock
import time
import multiscanner
from multiscanner.common import utils
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals



CWD = os.path.dirname(os.path.abspath(__file__))


def test_loadModule():
    """Ensure _loadModule works"""
    m = utils.load_module('test_1', [os.path.join(CWD, "modules")])
    assert isinstance(m, types.ModuleType)


def test_fail_loadModule():
    """Ensure _loadModule works"""
    m = utils.load_module('notathing', [os.path.join(CWD, "modules")])
    assert m is None


class _runmod_tests(object):
    @classmethod
    def setup_class(cls):
        cls.real_mod_dir = multiscanner.MODULESDIR
        multiscanner.MODULESDIR = os.path.join(CWD, "modules")

# Path: multiscanner/common/utils.py
#     SSH = True
#     SSH = False
# def load_module(name, path):
# def list2cmdline(list):
# def convert_encoding(data, encoding='UTF-8', errors='replace'):
# def parse_config(config_object):
# def get_config_path(config_file, component):
# def dirname(path):
# def basename(path):
# def parseDir(directory, recursive=False, exclude=['__init__']):
# def parseFileList(FileList, recursive=False):
# def chunk_file_list(filelist, cmdlength=7191):
# def queue2list(queue):
# def hashfile(fname, hasher, blocksize=65536):
# def sshconnect(hostname, port=22, username=None, password=None, pkey=None,
#                key_filename=None, timeout=None, allow_agent=True,
#                look_for_keys=True, compress=False, sock=None):
# def sessionexec(client, cmd):
# def sshexec(hostname, cmd, port=22, username=None, password=None,
#             key_filename=None):


# Path: multiscanner/tests/test_modules.py
import os
import types
import mock
import time
import multiscanner
from multiscanner.common import utils

from __future__ import division, absolute_import, with_statement, print_function, unicode_literals



CWD = os.path.dirname(os.path.abspath(__file__))


def test_loadModule():
    """Ensure _loadModule works"""
    m = utils.load_module('test_1', [os.path.join(CWD, "modules")])
    assert isinstance(m, types.ModuleType)


def test_fail_loadModule():
    """Ensure _loadModule works"""
    m = utils.load_module('notathing', [os.path.join(CWD, "modules")])
    assert m is None


class _runmod_tests(object):
    @classmethod
    def setup_class(cls):
        cls.real_mod_dir = multiscanner.MODULESDIR
        multiscanner.MODULESDIR = os.path.join(CWD, "modules")

        cls.filelist = utils.parseDir(os.path.join(CWD, 'files'))