# 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/tests/unit/base.py
# CONF = cfg.CONF
# class MuranoAgentTestCase(testtools.TestCase):
#     def setUp(self):
#     def override_config(self, name, override, group=None):


import os.path
from unittest import mock
from muranoagent import bunch
from muranoagent.common import config as cfg
from muranoagent import files_manager
from muranoagent.tests.unit import base
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



CONF = cfg.CONF


class TestFileManager(base.MuranoAgentTestCase):

    @mock.patch('os.path.isdir')
    @mock.patch('os.mkdir')
    @mock.patch('os.makedirs')
    def setUp(self, mock_makedir, mock_mkdir, mock_path):
        mock_path.return_value = True
        mock_mkdir.return_value = None
        mock_makedir.return_value = None
        super(TestFileManager, self).setUp()
        CONF.set_override('storage', 'cache')

    def test_is_svn(self):
        files = files_manager.FilesManager(self.get_template_downloable(1))
        self.assertTrue(files._is_svn_repository("https://sdfa/svn/ss"))

    def test_is_svn_first(self):
        files = files_manager.FilesManager(self.get_template_downloable(2))
        self.assertTrue(files._is_svn_repository("svn://test"))

    def test_is_svn_wrong_http_protocol(self):

# 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/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_files_manager.py
import os.path
from unittest import mock
from muranoagent import bunch
from muranoagent.common import config as cfg
from muranoagent import files_manager
from muranoagent.tests.unit import base

#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



CONF = cfg.CONF


class TestFileManager(base.MuranoAgentTestCase):

    @mock.patch('os.path.isdir')
    @mock.patch('os.mkdir')
    @mock.patch('os.makedirs')
    def setUp(self, mock_makedir, mock_mkdir, mock_path):
        mock_path.return_value = True
        mock_mkdir.return_value = None
        mock_makedir.return_value = None
        super(TestFileManager, self).setUp()
        CONF.set_override('storage', 'cache')

    def test_is_svn(self):
        files = files_manager.FilesManager(self.get_template_downloable(1))
        self.assertTrue(files._is_svn_repository("https://sdfa/svn/ss"))

    def test_is_svn_first(self):
        files = files_manager.FilesManager(self.get_template_downloable(2))
        self.assertTrue(files._is_svn_repository("svn://test"))

    def test_is_svn_wrong_http_protocol(self):

        files = files_manager.FilesManager(self.get_template_downloable(3))