<s> from __future__ import unicode_literals <EOL> import logging <EOL> from mock import Mock , patch <EOL> from sprinter . testtools import FormulaTest , set_os_types <EOL> import sprinter . lib as lib <EOL> source_config = """<STR_LIT>""" <EOL> target_config = """<STR_LIT>""" <EOL> class TestPackageFormula ( FormulaTest ) : <EOL> def setup ( self ) : <EOL> super ( TestPackageFormula , self ) . setup ( source_config = source_config , <EOL> target_config = target_config ) <EOL> self . which_original = lib . which <EOL> lib . which = Mock ( return_value = True ) <EOL> def teardown ( self ) : <EOL> lib . which = self . which_original <EOL> @ patch . object ( lib , '<STR_LIT>' ) <EOL> def test_simple_example_osx ( self , call ) : <EOL> """<STR_LIT>""" <EOL> with set_os_types ( osx = True ) : <EOL> self . environment . run_feature ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> call . assert_called_with ( "<STR_LIT>" , output_log_level = logging . DEBUG , stdout = None ) <EOL> @ patch . object ( lib , '<STR_LIT>' ) <EOL> def test_simple_example_debian ( self , call ) : <EOL> """<STR_LIT>""" <EOL> with set_os_types ( debian = True ) : <EOL> self . environment . run_feature ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> call . assert_called_with ( "<STR_LIT>" , output_log_level = logging . DEBUG , stdout = None ) <EOL> @ patch . object ( lib , '<STR_LIT>' ) <EOL> def test_simple_example_fedora ( self , call ) : <EOL> """<STR_LIT>""" <EOL> with set_os_types ( fedora = True ) : <EOL> self . environment . run_feature ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> call . assert_called_with ( "<STR_LIT>" , output_log_level = logging . DEBUG , stdout = None ) <EOL> @ patch . object ( lib , '<STR_LIT>' ) <EOL> def test_no_update ( self , call ) : <EOL> """<STR_LIT>""" <EOL> self . environment . run_feature ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert not call . called , "<STR_LIT>" <EOL> @ patch . object ( lib , '<STR_LIT>' ) <EOL> def test_update_different_package ( self , call ) : <EOL> """<STR_LIT>""" <EOL> with set_os_types ( debian = True ) : <EOL> self . environment . run_feature ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> call . assert_called_with ( "<STR_LIT>" , output_log_level = logging . DEBUG , stdout = None ) </s>
