<s> from __future__ import absolute_import <EOL> from salttesting import skipIf , TestCase <EOL> from salttesting . helpers import ensure_in_syspath <EOL> from salttesting . mock import NO_MOCK , NO_MOCK_REASON , patch <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . modules import config <EOL> config . __opts__ = config . __pillar__ = { } <EOL> __opts__ = { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> __pillar__ = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } <EOL> DEFAULTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class TestModulesConfig ( TestCase ) : <EOL> def test_defaults_only_name ( self ) : <EOL> with patch . dict ( config . DEFAULTS , DEFAULTS ) : <EOL> opt_name = '<STR_LIT>' <EOL> opt = config . option ( opt_name ) <EOL> self . assertEqual ( opt , config . DEFAULTS [ opt_name ] ) <EOL> def test_omits ( self ) : <EOL> with patch . dict ( config . DEFAULTS , DEFAULTS ) : <EOL> with patch . dict ( config . __pillar__ , __pillar__ ) : <EOL> with patch . dict ( config . __opts__ , __opts__ ) : <EOL> opt_name = '<STR_LIT>' <EOL> opt = config . option ( opt_name , <EOL> omit_opts = False , <EOL> omit_master = True , <EOL> omit_pillar = True ) <EOL> self . assertEqual ( opt , config . __opts__ [ opt_name ] ) <EOL> opt = config . option ( opt_name , <EOL> omit_opts = True , <EOL> omit_master = True , <EOL> omit_pillar = False ) <EOL> self . assertEqual ( opt , config . __pillar__ [ opt_name ] ) <EOL> opt = config . option ( opt_name , <EOL> omit_opts = True , <EOL> omit_master = False , <EOL> omit_pillar = True ) <EOL> self . assertEqual ( <EOL> opt , config . __pillar__ [ '<STR_LIT>' ] [ opt_name ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( TestModulesConfig , needs_daemon = False ) </s>
