# Path: sprinter/testtools.py
# class FormulaTest(object):
# 
#     def setup(self, **kw):
#         self.environment, self.temp_directory = create_mock_environment(**kw)
#         # adding some extra mocking
#         self.directory = self.environment.directory
#         self.environment.instantiate_features()
# 
#     def tearDown(self):
#         shutil.rmtree(self.temp_directory)
# 
# @contextmanager
# def set_os_types(osx=False, debian=False, fedora=False):
#     with patch('sprinter.lib.system.is_osx') as is_osx:
#         is_osx.return_value = osx
#         with patch('sprinter.lib.system.is_debian') as is_debian:
#             is_debian.return_value = debian
#             with patch('sprinter.lib.system.is_fedora') as is_fedora:
#                 is_fedora.return_value = fedora
#                 yield


import logging
import sprinter.lib as lib
from mock import Mock, patch
from sprinter.testtools import FormulaTest, set_os_types


class TestPackageFormula(FormulaTest):

    def setup(self):
        super(TestPackageFormula, self).setup(source_config=source_config,
                                              target_config=target_config)
        self.which_original = lib.which
        lib.which = Mock(return_value=True)

    def teardown(self):
        lib.which = self.which_original

    @patch.object(lib, 'call')
    def test_simple_example_osx(self, call):
        """ A brew package should install on osx """
        with set_os_types(osx=True):
            self.environment.run_feature('simple_example', 'sync')
            call.assert_called_with("brew install git", output_log_level=logging.DEBUG, stdout=None)

    @patch.object(lib, 'call')
    def test_simple_example_debian(self, call):
        """ An apt-get package should install on debian """
        with set_os_types(debian=True):
            self.environment.run_feature('simple_example', 'sync')
            call.assert_called_with("sudo apt-get -y install git-core", output_log_level=logging.DEBUG, stdout=None)

    @patch.object(lib, 'call')
    def test_simple_example_fedora(self, call):
        """ A yum package should install properly on fedora """

# Path: sprinter/testtools.py
# class FormulaTest(object):
# 
#     def setup(self, **kw):
#         self.environment, self.temp_directory = create_mock_environment(**kw)
#         # adding some extra mocking
#         self.directory = self.environment.directory
#         self.environment.instantiate_features()
# 
#     def tearDown(self):
#         shutil.rmtree(self.temp_directory)
# 
# @contextmanager
# def set_os_types(osx=False, debian=False, fedora=False):
#     with patch('sprinter.lib.system.is_osx') as is_osx:
#         is_osx.return_value = osx
#         with patch('sprinter.lib.system.is_debian') as is_debian:
#             is_debian.return_value = debian
#             with patch('sprinter.lib.system.is_fedora') as is_fedora:
#                 is_fedora.return_value = fedora
#                 yield


# Path: sprinter/formula/tests/test_package.py
import logging
import sprinter.lib as lib
from mock import Mock, patch
from sprinter.testtools import FormulaTest, set_os_types



class TestPackageFormula(FormulaTest):

    def setup(self):
        super(TestPackageFormula, self).setup(source_config=source_config,
                                              target_config=target_config)
        self.which_original = lib.which
        lib.which = Mock(return_value=True)

    def teardown(self):
        lib.which = self.which_original

    @patch.object(lib, 'call')
    def test_simple_example_osx(self, call):
        """ A brew package should install on osx """
        with set_os_types(osx=True):
            self.environment.run_feature('simple_example', 'sync')
            call.assert_called_with("brew install git", output_log_level=logging.DEBUG, stdout=None)

    @patch.object(lib, 'call')
    def test_simple_example_debian(self, call):
        """ An apt-get package should install on debian """
        with set_os_types(debian=True):
            self.environment.run_feature('simple_example', 'sync')
            call.assert_called_with("sudo apt-get -y install git-core", output_log_level=logging.DEBUG, stdout=None)

    @patch.object(lib, 'call')
    def test_simple_example_fedora(self, call):
        """ A yum package should install properly on fedora """

        with set_os_types(fedora=True):