# Path: muranoagent/bunch.py
# class Bunch(dict):
#     def __getattr__(self, item):
#     def __setattr__(self, key, value):
#     def __delattr__(self, key):
# 
# Path: muranoagent/common/config.py
# CONF = cfg.CONF
# def parse_args(args=None, usage=None, default_config_files=None):
# 
# Path: muranoagent/files_manager.py
# CONF = config.CONF
# LOG = logging.getLogger(__name__)
# class FilesManager(object):
#     def __init__(self, execution_plan):
#     def put_file(self, file_id, script):
#     def _make_symlink(self, cache_path, file_name, script):
#     def _fetch_file(self, file_id):
#     def _download_url_file(self, file_def, file_id):
#     def clear(self):
#     def _download_file(self, url, path):
#     def _url(self, file):
#     def _is_git_repository(self, url):
#     def _is_svn_repository(self, url):
#     def _download_svn(self, url_file, folder):
#     def _execute_command(self, command):
# 
# Path: muranoagent/script_runner.py
# class FunctionRunner(object):
# class ScriptRunner(object):
#     def __init__(self, name, script_runner):
#     def __call__(self, *args, **kwargs):
#     def __init__(self, name, script_info, files_manager):
#     def __call__(self, *args, **kwargs):
#     def _get_executor(self, script_type, script_name, entry_point):
#     def execute_function(self, name, *args, **kwargs):
#     def __getattr__(self, item):
#     def _load(self):
#     def _prepare_files(self):
# 
# Path: muranoagent/tests/unit/base.py
# CONF = cfg.CONF
# class MuranoAgentTestCase(testtools.TestCase):
#     def setUp(self):
#     def override_config(self, name, override, group=None):


import git
from unittest import mock
from muranoagent import bunch
from muranoagent.common import config as cfg
from muranoagent import files_manager as fmanager
from muranoagent import script_runner
from muranoagent.tests.unit import base
        mock_file_manager.put_file.return_value = None
        mock_executors.create_executor.return_value = None
        mock_os.return_value = '/tmp/1234'
        template = self.get_template_downloable_git()
        scripts = script_runner\
            .ScriptRunner('deploy',
                          template.get('Scripts')['deploy'],
                          mock_file_manager)
        scripts._prepare_files()

    def _stub_uuid(self, values=None):
        class FakeUUID(object):
            def __init__(self, v):
                self.hex = v

        if values is None:
            values = []
        mock_uuid4 = mock.patch('uuid.uuid4').start()
        mock_uuid4.side_effect = [FakeUUID(v) for v in values]
        return mock_uuid4

    def get_template_downloable_git(self):
        return bunch.Bunch(
            ID='ID',
            Files={
                'mycoockbook': {
                    'Name': 'mycoockbook.txt',
                    'URL': 'https://github.com/tomcat.git',
                    'Type': 'Downloadable'
                }

# Path: muranoagent/bunch.py
# class Bunch(dict):
#     def __getattr__(self, item):
#     def __setattr__(self, key, value):
#     def __delattr__(self, key):
# 
# Path: muranoagent/common/config.py
# CONF = cfg.CONF
# def parse_args(args=None, usage=None, default_config_files=None):
# 
# Path: muranoagent/files_manager.py
# CONF = config.CONF
# LOG = logging.getLogger(__name__)
# class FilesManager(object):
#     def __init__(self, execution_plan):
#     def put_file(self, file_id, script):
#     def _make_symlink(self, cache_path, file_name, script):
#     def _fetch_file(self, file_id):
#     def _download_url_file(self, file_def, file_id):
#     def clear(self):
#     def _download_file(self, url, path):
#     def _url(self, file):
#     def _is_git_repository(self, url):
#     def _is_svn_repository(self, url):
#     def _download_svn(self, url_file, folder):
#     def _execute_command(self, command):
# 
# Path: muranoagent/script_runner.py
# class FunctionRunner(object):
# class ScriptRunner(object):
#     def __init__(self, name, script_runner):
#     def __call__(self, *args, **kwargs):
#     def __init__(self, name, script_info, files_manager):
#     def __call__(self, *args, **kwargs):
#     def _get_executor(self, script_type, script_name, entry_point):
#     def execute_function(self, name, *args, **kwargs):
#     def __getattr__(self, item):
#     def _load(self):
#     def _prepare_files(self):
# 
# Path: muranoagent/tests/unit/base.py
# CONF = cfg.CONF
# class MuranoAgentTestCase(testtools.TestCase):
#     def setUp(self):
#     def override_config(self, name, override, group=None):


# Path: muranoagent/tests/unit/test_script_runner.py
import git
from unittest import mock
from muranoagent import bunch
from muranoagent.common import config as cfg
from muranoagent import files_manager as fmanager
from muranoagent import script_runner
from muranoagent.tests.unit import base

        mock_file_manager.put_file.return_value = None
        mock_executors.create_executor.return_value = None
        mock_os.return_value = '/tmp/1234'
        template = self.get_template_downloable_git()
        scripts = script_runner\
            .ScriptRunner('deploy',
                          template.get('Scripts')['deploy'],
                          mock_file_manager)
        scripts._prepare_files()

    def _stub_uuid(self, values=None):
        class FakeUUID(object):
            def __init__(self, v):
                self.hex = v

        if values is None:
            values = []
        mock_uuid4 = mock.patch('uuid.uuid4').start()
        mock_uuid4.side_effect = [FakeUUID(v) for v in values]
        return mock_uuid4

    def get_template_downloable_git(self):
        return bunch.Bunch(
            ID='ID',
            Files={
                'mycoockbook': {
                    'Name': 'mycoockbook.txt',
                    'URL': 'https://github.com/tomcat.git',
                    'Type': 'Downloadable'
                }

            },